Write a program which repeatedly reads numbers until the use
Write a program which repeatedly reads numbers until the user enters “done”. Once “done” is entered, print out the total, count, and average of the numbers.
Solution
#include<stdio.h>
 #include<string.h>
 int main()
 {
 int a;
 int i=0;
 int sum=0;
 float avg=0;
 printf(\"Keep entering numbers and when you are done press some character\ \");
 while((scanf(\"%d\",&a)) == 1)
 {   
 sum +=a;
 i++;
 }   
 avg = sum/i;
 printf(\"User has ended giving inputs\ \");
 printf(\"The count of input numbers is %d\",i);
 printf(\"The total of %d numbers is %d\",i,sum);
 printf(\"The average of %d numbers is %f\",i, avg);
 return 0;
 }
sample output :
Keep entering numbers and when you are done press some character
 1
 2
 3
 4
 5
 6
 doneUser has ended giving inputs
 The count of input numbers is 6The total of 6 numbers is 21The average of 6 numbers is 3.000000

