Q WAP to input marks in five subjects of a student and calculate the division according to the following conditions:
#include<stdio.h>
#include<conio.h>
void main()
{float m1,m2,m3,m4,m5,p;
clrscr();
printf("enter number");
scanf("%f%f%f%f%f",&m1,&m2,&m3,&m4,&m5);
p=(m1+m2+m3+m4+m5)/5;
printf("\n total p: %f",p);
if(p>=60)
printf("\n first");
else if (p>=50&&p<=59)
printf("\n second");
else if(p>=40&&p<=49)
printf("\n third");
else if (p<40)
printf("\nfail");
getch();
}
Percentage Division
>=60 First
50-59 Second
40-49 Third
<40 Fail#include<stdio.h>
#include<conio.h>
void main()
{float m1,m2,m3,m4,m5,p;
clrscr();
printf("enter number");
scanf("%f%f%f%f%f",&m1,&m2,&m3,&m4,&m5);
p=(m1+m2+m3+m4+m5)/5;
printf("\n total p: %f",p);
if(p>=60)
printf("\n first");
else if (p>=50&&p<=59)
printf("\n second");
else if(p>=40&&p<=49)
printf("\n third");
else if (p<40)
printf("\nfail");
getch();
}
No comments:
Post a Comment