C Program Sum and Average Calculator
#include <stdio.h> int main() { int n1, n2, n3, n4, n5, sum; float average; printf("Enter 5 numbers\n"); scanf("%d%d%d%d%d", &n1,&n2,&n3,&n4,&n5); sum = n1 + n2 + n3 + n4 + n5; average = sum / 5.0; printf("Sum=%d and Average=%.2f", sum, average); return 0; }
Output
Enter 5 numbers
10
20
30
10
20
Sum=90 and Average=18.00
Press Enter to return to Quincy…