/* Grade Calculation */
/* Suchetan Dey */
#include<stdio.h>
#include<conio.h>
void main()
{
int roll,marks1,marks2,marks3,total;
char grade,name[8];
printf("Enter Your Name ");
scanf("%s",&name);
printf("Enter Your Roll Number ");
scanf("%d",&roll);
printf("Enter marks1 ");
scanf("%d",&marks1);
printf("Enter marks2 ");
scanf("%d",&marks2);
printf("Enter marks3 ");
scanf("%d",&marks3);
total=marks1+marks2+marks3;
printf("Total Marks Is %d",total);
printf("\n\n\n ");
if(total>=280)
{
grade='a';
printf("Grade=%c",grade);
}
if(total>=250 && total<280)
{
grade='b';
printf("Grade=%c",grade);
}
if(total>=180 && total<250)
{
grade='c';
printf("Grade=%c",grade);
}
else if(total<180)
{
grade='f';
printf("Grade=%c",grade);
}
getch();
}
The Output is :-
/* Suchetan Dey */
#include<stdio.h>
#include<conio.h>
void main()
{
int roll,marks1,marks2,marks3,total;
char grade,name[8];
printf("Enter Your Name ");
scanf("%s",&name);
printf("Enter Your Roll Number ");
scanf("%d",&roll);
printf("Enter marks1 ");
scanf("%d",&marks1);
printf("Enter marks2 ");
scanf("%d",&marks2);
printf("Enter marks3 ");
scanf("%d",&marks3);
total=marks1+marks2+marks3;
printf("Total Marks Is %d",total);
printf("\n\n\n ");
if(total>=280)
{
grade='a';
printf("Grade=%c",grade);
}
if(total>=250 && total<280)
{
grade='b';
printf("Grade=%c",grade);
}
if(total>=180 && total<250)
{
grade='c';
printf("Grade=%c",grade);
}
else if(total<180)
{
grade='f';
printf("Grade=%c",grade);
}
getch();
}
The Output is :-
No comments:
Post a Comment