C Program : Write a Program to Calculate the Average of Three Real Number

What is scanf()?

The scanf() function is used to readd the values for variables from standard input device i.e., keyword.

     Syntax : scanf("control string", address_List);

What is prinft()?

printf() function is ued to print result on monitor.


Code :


 #Include <stdio.h>
 main()
 {
   float a, b, c, avg;
   printf("enter three real numbers : ");
   scanf("%f %f %f": &a, &b, &c);
   avg = (a + b + c)/3;
   prinft("Average of the given three real numbers %f ", avg);
 }


Input : Enter three real numbers : 1.2, 2.3, 3.4
Output : Average of the given three real numbers is 2.30000

Post a Comment

0 Comments