Advertisement
Guest User

Untitled

a guest
Apr 28th, 2015
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include <stdio.h>
  2. int main ()
  3. {
  4. int total_no, count = 1;
  5. float number, average, sum =0;
  6.  
  7. printf("How many numbers? ");
  8. scanf("%d", &total_no);
  9.  
  10.  
  11. do{
  12.  
  13. printf("Enter number %d : ", count);
  14. scanf("%f", &number);
  15. sum +=number;
  16. count++;
  17.  
  18. }while (count <=total_no);
  19.  
  20. average = sum / total_no;
  21. printf("Average is : %f\n", average);
  22.  
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement