Program to find average marks and declare as pass or fail
#include<stdio.h>
void main()
{
float m1,m2,m3,avg;
printf("Enter your marks: ");
scanf("%f%f%f",&m1,&m2,&m3);
avg=(m1+m2+m3)/3;
if (avg>=35)
{
printf("Your average is: %f\nPass:)",avg);
}
else
{
printf("Your average is: %f\nFail:(",avg);
}
}
Explanation:
Here, we have taken 3 marks as m1,m2 and m3.
Then we found out its average and if average was more than 35 we declared it as pass and if average was less than 35 we declared it as fail.
Output:
void main()
{
float m1,m2,m3,avg;
printf("Enter your marks: ");
scanf("%f%f%f",&m1,&m2,&m3);
avg=(m1+m2+m3)/3;
if (avg>=35)
{
printf("Your average is: %f\nPass:)",avg);
}
else
{
printf("Your average is: %f\nFail:(",avg);
}
}
Explanation:
Here, we have taken 3 marks as m1,m2 and m3.
Then we found out its average and if average was more than 35 we declared it as pass and if average was less than 35 we declared it as fail.
Output:
No comments:
Post a Comment