C program to read three numbers and find average of numbers.
Solution:
Output:

In the above output, we can fix the digit after decimal points while printing an average of three numbers. If we want to fix 2 digits after decimal point, then we can use (.2) in the following statement.
printf("\nAverage of Three Numbers : %.2f",avg);
Following is the output after writing above statement in program.

Solution:
#include <stdio.h>
int main()
{
int a,b,c;
float avg;
printf("\tEnter Three Numbers\n");
printf("--------------------------------\n");
printf("Enter First Number : ");
scanf("%d", &a);
printf("\nEnter Second Number : ");
scanf("%d",&b);
printf("\nEnter Third Number : ");
scanf("%d",&c);
printf("--------------------------------\n");
/* To find average*/
avg=a+b+c/3.0;
printf("\nAverage of Three Numbers : %f",avg);
return 0;
}
Output:

In the above output, we can fix the digit after decimal points while printing an average of three numbers. If we want to fix 2 digits after decimal point, then we can use (.2) in the following statement.
printf("\nAverage of Three Numbers : %.2f",avg);
Following is the output after writing above statement in program.



