google.com, pub-6167773875660516, DIRECT, f08c47fec0942fa0 Write a c program to find grade of a student using if else - 2nd puc computer science

Write a c program to find grade of a student using if else

Write a c program to find grade of a student using if else

Write a c program to print grade of a student using if else statement

#include<stdio.h>

#include<conio.h>

void main()

{

int s1,s2,s3;

float percentage;

clrscr();

printf("Enter three subjects marks:\n");

scanf("%d%d%d",&s1,&s2,&s3);

percentage=(s1+s2+s3)/3.0;

printf("Percentage=%f\n",percentage);

if(percentage>=85.0&&percentage<=100.0)

printf("Distinction");

else

if(percentage>=60.0)

printf("First class");

else

if(percentage>=50.0)

printf("Second class");

else

if(percentage>=35.0)

printf("Pass class");

else

printf("Fail");

getch();

}

Output:


run 1:

Enter the percentage: 92

Distinction


run 2:

Enter the percentage: 80

First class


run 3:

Enter the percentage: 55

Second class


run 4:

Enter the percentage: 42

Pass class


run 5:

Enter the percentage: 33

Fail

Write a c program to find grade of a student using if else Write a c program to find grade of a student using if else Reviewed by Vision Academy on January 06, 2022 Rating: 5

No comments:

CheckOut

Powered by Blogger.