Answer :
#include<stdio.h> //header file contains the function,decleraction and macro defination of key words used in code.
int main ()
{
float eng,maths,sci,mara,soc_sci,percentage,totalmarks=500,add; //adressing the variables
printf("Enter your marks in English "); //output
scanf("%f",&eng); //adressing the variables
printf("Enter your marks in Maths "); //output
scanf("%f",&maths); //adressing the variables
printf("Enter your marks in Science "); //output
scanf("%f",&sci); //adressing the variables
printf("Enter your marks in Marathi "); //output
scanf("%f",&mara); //adressing the variables
printf("Enter your marks in Social Science "); //output
scanf("%f",&soc_sci); //adressing the variables
printf("\n************************************************\n\n"); //output desgin
printf("English=%.2f\tScience=%.2f\tMarathi=%.2f\t\nMaths=%.2f\tSocial Science=%.2f\n",eng,sci,mara,maths,soc_sci); //output the mrks enter
printf("\n************************************************\n\n"); //output desgin
add=eng+maths+mara+sci+soc_sci; // addition of marks
printf("Total marks you got is %.2f\n\n",add); //output of total marks gained.
percentage=add/totalmarks*100; // percentage formula.
printf("%.2f is the percentage you got\n\n",percentage); //output
if (percentage>=81 && percentage<=100) // condition
{
printf("#####################################\n\n"); //output desgin
printf("\tYou got Grade \"A\""); //output
printf("\n\n#####################################"); //output desgin
}
else if (percentage>=61 && percentage<=80) //condition
{
printf("#####################################\n\n"); //output desgin
printf("\tYou got Grade \"B\""); //output
printf("\n\n#####################################"); //output desgin
}
else if (percentage>=40 && percentage<=60) //condition
{
printf("#####################################\n\n"); //output desgin
printf("\tYou have passed"); //output
printf("\n\n#####################################"); //output desgin
}
else
{
printf("#####################################\n\n"); //output desgin
printf("\tYou have failed"); //output
printf("\n\n#####################################"); //output desgin
}
}
Output :
0 Comments