Calculating the average of numbers is a common operation in programming. In C, you can easily compute the average of three numbers using simple arithmetic operations. Letâ€™s write a simple C program that calculates the average of three given numbers.

**C Program to find Average of 3 Numbers**

Below is a simple C program that takes three numbers as input, computes their average, and displays the result:

```
#include <stdio.h>
void main() {
// Declare variables to store three numbers
float num1, num2, num3;
// Prompt user to input three numbers
printf("Enter three numbers: ");
scanf("%f %f %f", &num1, &num2, &num3);
// Calculate the average of the three numbers
float average = (num1 + num2 + num3) / 3;
// Display the computed average
printf("The average of %.2f, %.2f, and %.2f is: %.2f\n", num1, num2, num3, average);
}
```

**Output**

**C Program to find Average of 3 Numbers Explanation**

**Variable Declaration:**Three variables (`num1`

,`num2`

,`num3`

) of type`float`

are declared to store the input numbers.**User Input:**The program prompts the user to input three numbers using`printf()`

and reads these values using`scanf()`

.**Average Calculation:**The average of the three numbers is computed by adding them together and dividing the sum by the total count of numbers, which in this case is 3.**Display Output:**Finally, the program displays the input numbers along with the computed average using`printf()`

.

Calculating the average of three numbers in C involves basic arithmetic operations. By following this simple program structure, we can calculate the average of three given numbers.

## 6 thoughts on “C Program to Find Average of 3 Numbers”