#include<stdio.h> #include<conio.h> void main() { Int a,b,c; float avg; /*variable for storing the result, which may be float */ clrscr(); /*for clearing the output screen*/ printf(“enter three numbers\n”); scanf(“d%d%d”,&a,&b,&c); /*inputting the values from keyboard*/ avg=(a+b+c)/3; /*gives the average in terms of integer as numerator & denominator are integers*/ printf(“\n average of %d %d and %d is %f\n”, a,b,c,avg); getch(); } Output: Enter three numbers 8 10 8 average of 8 10 and 8 is 8.000000

**Note:** While making division operations we have to take care of fractions. When we are dividing one integer by another, the result we get is also an integer (truncates the fractional part and considers only integer part). To avoid this and to get the float value we have to make either numerator or both as float value by proper type casting.

C displays 6 digits of precision by default. If we want to specify the required number o digits of precision, then that can be achieved by specifying number of digits of precision in the format. For example %2f gives only 2 digits after decimal point(.). %8f gives * digits after ‘.’ And so no.