Sunday, 10 December 2017

Calculate Your Result Using C Language

#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 subone, subtwo, subthree, subfour, subfive, omarks, total = 500;
float percentage;
printf("\nPlease Enter 1st Subject Numbers : ");
scanf("%d",&subone);
printf("\nPlease Enter 2nd Subject Numbers : ");
scanf("%d",&subtwo);
printf("\nPlease Enter 3rd Subject Numbers : ");
scanf("%d",&subthree);
printf("\nPlease Enter 4th Subject Numbers : ");
scanf("%d",&subfour);
printf("\nPlease Enter 5th Subject Numbers : ");
scanf("%d",&subfive);



printf("\nTotal Marks : %d", total);



omarks = subone+ subtwo+ subthree+ subfour+ subfive;
printf("\nObtain Marks : %d", omarks);



percentage = (omarks * 100) / total;
printf("\nYour Percentage : %f", percentage);



printf("\nYour Grade is :");
if (omarks>=430 && omarks<=500)


{
printf(" A+ ");


}
else
if(omarks>=350 && omarks<425)


{
printf(" A ");


}
else
if(omarks>=300 && omarks<350)


{
printf(" B ");


}
else
if(omarks>=225 && omarks<300)


{
printf(" C ");


}
else


{
printf(" F ");


}
return 0;


}

0 comments:

Post a Comment

Tech UOG