0% found this document useful (0 votes)
5 views1 page

Sum and Average of Three Numbers Program

This document presents a C program that calculates the sum and average of three user-inputted numbers. It prompts the user for input, computes the sum and average, and displays the results. An example output is provided, showing the program in action with the numbers 10, 20, and 30.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Sum and Average of Three Numbers Program

This document presents a C program that calculates the sum and average of three user-inputted numbers. It prompts the user for input, computes the sum and average, and displays the results. An example output is provided, showing the program in action with the numbers 10, 20, and 30.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Program 1: Calculate sum and average of three numbers.

#include <stdio.h>
int main() {
int a, b, c, sum;
float average;
printf("Enter three numbers: ");
scanf("%d %d %d", &a, &b, &c);
sum = a + b + c;
average = (float)sum / 3;
printf("Sum = %d\n", sum);
printf("Average = %.2f\n", average);
return 0;
Output:
Enter three numbers: 10 20 30
Sum = 60
Average = 20.00

You might also like