Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- main(){
- int nums, totaln, totalo=0, add;
- float avg;
- printf("How many numbers do you want to average?");
- scanf("%d", &nums);
- for (int i=0; i<nums; i++){
- scanf("%i", &add);
- totaln=totalo+add;
- printf("%i", totaln);
- totalo=totaln
- }
- avg=totaln/nums
- printf("The average of your numbers is %.3f.", avg);
- }
Advertisement
Add Comment
Please, Sign In to add comment