Program to find 5 subject marks and calculate percentage and division of student using if-else ladder.
#include <stdio.h>
#include <conio.h>
void main()
{
int a, b, c, d, e, sum, total = 100;
float perc;
clrscr();
printf ("Enter marks of 5 subjects: ");
scanf ("%d%d%d%d%d", &a, &b, &c, &d, &e);
sum = a + b + c + d + e ;
perc = ((sum*100)/total);
if (perc < 40)
printf ("You are FAIL!");
else
{
if (perc >= 60)
printf ("You have got 1st Division.");
else
{
if (perc >= 50)
printf ("You have got 2nd Division.");
else
printf ("You have got 3rd Division.");
}
}
getch();
}
#include <stdio.h>
#include <conio.h>
void main()
{
int a, b, c, d, e, sum, total = 100;
float perc;
clrscr();
printf ("Enter marks of 5 subjects: ");
scanf ("%d%d%d%d%d", &a, &b, &c, &d, &e);
sum = a + b + c + d + e ;
perc = ((sum*100)/total);
if (perc < 40)
printf ("You are FAIL!");
else
{
if (perc >= 60)
printf ("You have got 1st Division.");
else
{
if (perc >= 50)
printf ("You have got 2nd Division.");
else
printf ("You have got 3rd Division.");
}
}
getch();
}