2.Write a program to find the average of three numbers?
#include
#include
{
float a,b,c,avg;
clrscr();
printf("enter three numbers");
scanf("%f%f%f",&a,&b,&c);
avg=(a+b+c)/3;
printf("result is %f",avg);
getch();
}
Algorithum
1.start
2.read three numbers a b c
3.calculate avg =a+b+c/3
4.print avg
5.stop
Result
The program is sucessfully executed and the desired output is obtained.
Output
enter three nos.
2 4 6
result is 4
Average of three numbers
Labels: C-program
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment