// Program to find average of numbers
#include
#include
void main()
{
clrscr();
float sub1, sub2, sub3, marks, avg;
printf("Enter marks obtained in first subject");
scanf("%f", &sub1);
printf("Enter marks obtained in second subject");
scanf("%f", &sub2);
printf("Enter marks obtained in third subject");
scanf("%f", &sub3);
marks=sub1+sub2+sub3;
avg=marks/3;
printf("The average marks are %f", avg);
getch();
}
Algorithm
· Start
· Declare sub1, sub2, sub3, marks, avg as float
· Write ("marks of first subject")
· Read("marks of first subject”)
· Write ("marks of second subject")
· Read("marks of second subject”)
· Write ("marks of third subject")
· Read("marks of third subject”);
· marks=sub1+sub2+sub3
· avg=marks/3
· Read("The average marks”)
· stop
0 comments:
Post a Comment