C program to find grade of a student using FOR loop

SouvikFollowApr 22, 2020·2 min readC programmingC program to find grade of student by using nested else-if statementProblem DescriptionThis program take input as your number then s

C program to find grade of a student using FOR loop
Souvik

SouvikFollow

Apr 22, 2020·2 min read

C programming

C program to find grade of student by using nested else-if statement

Problem Description

This program take input as your number then show your grade.

Problem Solution

This program take input as your number then show your grade.

1. enter your marks as input.

2. then check your marks with If blocks condition. if it satisfied then show your grade as output.

3. if it not satisfied then it checks with all else-if blocks condition repeatedly.

4. print the grade according to your given marks as input and exit.

https://programminglanguagepoint.blogspot.com/2020/04/c-program-to-find-grade-of-student-by.html

Program codes:-

#include<stdio.h>
main()
{
int n;
printf(\n enter the marks:);
scanf(%d,&n);
if(n>89)
printf(O);
else if(n>79)
printf(E);
else if(n>69)
printf(A);
else if(n>59)
printf(B);
else if(n>49)
printf(C);
else if(n>39)
printf(D);
else
printf(F);
}

Program explanation:-

1. enter your marks. for example we take 70
.
2. then your input checks withif blocks condition. if it satisfied then it directly show the output.

3. if it doesnt satisfied then it goes to else-if blocks condition. if it satisfied with any else-if blocks then it show the grade as output.

4.if it doesnt satisfied with any else-if blocks condition then at last it goes to else blocks condition.

Originally published at https://programminglanguagepoint.blogspot.com.

Video liên quan