Q. Write a program to accept marks for three subjects and find the total marks secured , average and also display the class obtained
Program
#include<stdio.h>
void main()
{
int m1,m2,m3,total;
float per;
printf("Enter 3 subject marks : ");
scanf("%d%d%d",&m1,&m2,&m3);
total=m1+m2+m3;
per=total*100/300;
printf("total = %d",total);
printf("\n per = %.2f",per);
if(per>=60&&per<=100)
printf("\n You are in Distinction");
else if(per>=50&&per<=60)
printf("\n You are in 1st class");
else if(per>=40&&per<=50)
printf("\n You are in 2nd class");
else
printf("\n You are Fail");
}
Output:
Enter 3 subject marks : 78
56
67
total = 201
per = 67.00
You are in Distiction
Program
#include<stdio.h>
void main()
{
int m1,m2,m3,total;
float per;
printf("Enter 3 subject marks : ");
scanf("%d%d%d",&m1,&m2,&m3);
total=m1+m2+m3;
per=total*100/300;
printf("total = %d",total);
printf("\n per = %.2f",per);
if(per>=60&&per<=100)
printf("\n You are in Distinction");
else if(per>=50&&per<=60)
printf("\n You are in 1st class");
else if(per>=40&&per<=50)
printf("\n You are in 2nd class");
else
printf("\n You are Fail");
}
Output:
Enter 3 subject marks : 78
56
67
total = 201
per = 67.00
You are in Distiction
0 Comments