#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
int a,b,c,d,e,f;
printf("Enter your urdu marks \n");
scanf("%d",&a);
printf("Enter your English marks \n");
scanf("%d",&b);
printf("Enter your Maths marks \n");
scanf("%d",&c);
printf("Enter your Physics marks \n");
scanf("%d",&d);
printf("Enter your isl marks \n");
scanf("%d",&e);
f= a+b+c+d+e;
printf("---------------------------------- \n");
printf("your total marks out of 500 are %d \n",f);
float g=(f*100)/500;
printf("----------------------------------- \n");
printf(" your percentage is %.2f%% \n",g);
printf("----------------------------------- \n");
if(g<40){
printf("your grade is \"f\" \n");
}
else if(g>=40&&g<=49.9)
{
printf("your grade is \"D\"\n");
}
else if(g>=50&&g<=59.9)
{
printf("your grade is \"C\"\n");
}
else if(g>=60&&g<=69.9)
{
printf("your grade is \"B\"\n");
}
else if(g>=70&&g<=79.9)
{
printf("your grade is \"A\"\n");
}
else
{
printf("your grade is \"A+\"\n");
}
return 0;
}
Output
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
int a,b,c,d,e,f;
printf("Enter your urdu marks \n");
scanf("%d",&a);
printf("Enter your English marks \n");
scanf("%d",&b);
printf("Enter your Maths marks \n");
scanf("%d",&c);
printf("Enter your Physics marks \n");
scanf("%d",&d);
printf("Enter your isl marks \n");
scanf("%d",&e);
f= a+b+c+d+e;
printf("---------------------------------- \n");
printf("your total marks out of 500 are %d \n",f);
float g=(f*100)/500;
printf("----------------------------------- \n");
printf(" your percentage is %.2f%% \n",g);
printf("----------------------------------- \n");
if(g<40){
printf("your grade is \"f\" \n");
}
else if(g>=40&&g<=49.9)
{
printf("your grade is \"D\"\n");
}
else if(g>=50&&g<=59.9)
{
printf("your grade is \"C\"\n");
}
else if(g>=60&&g<=69.9)
{
printf("your grade is \"B\"\n");
}
else if(g>=70&&g<=79.9)
{
printf("your grade is \"A\"\n");
}
else
{
printf("your grade is \"A+\"\n");
}
return 0;
}
Output
Comments
Post a Comment