Subscribe For Free Updates!

We'll not spam mate! We promise.

Sunday 26 August 2012

C code to Displating percentage and grade of student


// Displating percentage and grade of student
// Programmer name: Sohail Ahmed
// 13/04/2011

#include<conio.h>
#include<stdio.h>

void main()
{
clrscr();
float eng, itp, eca, cal, per;
int op;
char loop;
do{
clrscr();
printf("\n\tEnter marks of English: ");
scanf("%f", &eng);
printf("\n\tEnter marks of ITP: ");
scanf("%f", &itp);
printf("\n\tEnter marks of ECA: ");
scanf("%f", &eca);
printf("\n\tEnter marks of Calculas: ");
scanf("%f", &cal);
per=(eng+itp+eca+cal)/400*100;
getch();
clrscr();
printf("\n\t***Menu***"
      "\n\t1. Percentage"
      "\n\t2. Grade"
      "\n\t3. Grade of Each sub");
printf("\n\n\tEnter any Option: ");
scanf("%d", &op);
switch(op)
{
case 1:
printf("\n\tYou have got %.2f Percentage", per);
break;
case 2:
if(per<40)
{
printf("\n\tSorry you are Failed");
}
else if(per<90)
{
printf("\n\tYou have got B Grade");
}
else
{
printf("\n\tCongrates you have got A grade");
}
break;
case 3:
printf("\nMarks of all Subjects");
printf("\nEnglish =\t\t%.1
f", eng);
printf("\nIntroduction to Prog =\t%.1f", itp);
printf("\nElectric Circuits =\t%.1f", eca);
printf("\nCalculas =\t\t%.1f", cal);
break;
default:
printf("\n\tInvalid option");
}
getch();
clrscr();
printf("\n\tDo you want to Continue....(Y OR N)");
loop=getche();
}while(loop=='Y' || loop=='y');
getch();
}

Socializer Widget By CodingLovers
SOCIALIZE IT →
FOLLOW US →
SHARE IT →

0 comments:

Post a Comment