C Program to Calculate Grades based on Three Subjects, Exercises of Computer Engineering and Programming

This c program calculates and assigns a letter grade (a, b, c, or d) based on the average of marks obtained in three subjects. The user is prompted to enter the marks of each subject using the scanf function.

Typology: Exercises

2011/2012

Uploaded on 07/28/2012

dewansh
dewansh 🇮🇳

4.4

(10)

89 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
2
#include<stdio.h>
#include<conio.h>
void main (void)
{
int sub1,sub2,sub3,av;
printf ("\n\nPlease enter the marks of three subjects\n");
scanf ("%d%d%d",&sub1,&sub2,&sub3);
av=(sub1+sub2+sub3)/3;
if (av>=80)
{
printf ("The Grade is A\n");
}
if (av<80)
{
if (av>=50)
printf ("The Grade is B\n");
}
if (av<50)
{
if (av>=33)
printf ("The Grade is C\n");
}
if (av<33)
{
printf ("The Grade is D\n");
}
getch();
}
Grading
docsity.com

Partial preview of the text

Download C Program to Calculate Grades based on Three Subjects and more Exercises Computer Engineering and Programming in PDF only on Docsity!

#include<stdio.h> #include<conio.h> void main (void) { int sub1,sub2,sub3,av; printf ("\n\nPlease enter the marks of three subjects\n"); scanf ("%d%d%d",&sub1,&sub2,&sub3); if (av>=80) av=(sub1+sub2+sub3)/3; { printf ("The Grade is A\n"); }^2 if (av<80) if (av<50) if (av<33) getch(); } { if (av>=50) printf ("The Grade is B\n"); } { if (av>=33) printf ("The Grade is C\n"); } { printf ("The Grade is D\n"); }^ Grading docsity.com