#include <stdio.h>
void main()
{
int rl, ch, ph, bi, total;
float percentage;
char name;
printf("enter your name character: ");
scanf("%c", &name);
printf("enter your roll number: ");
scanf("%d", &rl);
printf("enter a marks of first subjec: ");
scanf("%d", &ph);
printf("enter a marks of second subject: ");
scanf("%d", &ch);
printf("enter a marks of third subject: ");
scanf("%d", &bi);
total = ph + bi + ch;
percentage = (100 * total / 300);
if (percentage == 100)
{
printf("outstanding! \n");
}
else if (percentage >= 91 && percentage <= 100)
{
printf("exc.\n");
}
else if (percentage >= 81 && percentage <= 90)
{
printf("V.G\n");
}
else if (percentage >= 71 && percentage <= 80)
{
printf("good \n");
}
else if (percentage >= 61 && percentage <= 70)
{
printf("ave\n");
}
else if (percentage >= 51 && percentage <= 60)
{
printf("satis.\n");
}
else
{
printf("fail\n");
}
printf("sum is %d \n", total);
printf("percentage is %2.f\n", percentage);
}
OUTPUT
enter your name character: u
enter your roll number: 11
enter marks of the first subject: 85
enter marks of the second subject: 95
enter marks of the third subject: 74
V.G
sum is 254
percentage is 84
0 Comments