C Program To Find Total & Average Of 3 Numbers

C Program To Find Total & Average Of 3 Numbers

Code
// WAP To Find Average Of Three Numbers...

#include <stdio.h>
int main()
{
    int n1, n2, n3, total, avg;

    printf("Enter Number 1:\n");
    scanf("%d", &n1);
    printf("Enter Number 2:\n");
    scanf("%d", &n2);
    printf("Enter Number 3:\n");
    scanf("%d", &n3);
    total = (n1 + n2 + n3);
    printf("Total:%d\n", total);
    avg = total / 3;
    printf("Average Of Three Number Is:%d", avg);
}
Output
Enter Number 1:
7
Enter Number 2:
5
Enter Number 3:
9
Total:21
Average Of Three Number Is:7

Post a Comment