#include <stdio.h> #include <stdlib.h> int a; int main( ) { float sum = 0.0; int a=1; do { printf("%d \n",a); sum = sum + a; a++; if (a == 8) { printf("Average = %.4f\n", sum/10); exit(0); } } while (a <=10); printf("End program"); }
Standard input is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!