Write a C C++ program to find grade from given percent

 

Flowchart

Finding grade from given percent flowchart

 

Coding in C

#include<stdio.h>
int main()
{
float p;
printf(“Enter percent: “);
scanf(“%f”,&p);
if(p>=90)
{
printf(“A+”);
}
else if(p>=80)
{
printf(“A”);
}
else if(p>=60)
{
printf(“B”);
}
else if(p>=40)
{
printf(“C”);
}
else
{
printf(“D”);
}
return 0;
}

 

Coding in C++

#include<iostream>
using namespace std;
int main()
{
float p;
cout<<“Enter percent: “;
cin>>p;
if(p>=90)
{
cout<<“A+”;
}
else if(p>=80)
{
cout<<“A”;
}
else if(p>=60)
{
cout<<“B”;
}
else if(p>=40)
{
cout<<“C”;
}
else
{
cout<<“D”;
}
return 0;
}

 

Output

Finding grade from given percent output

 

Published by

admin

I am a computer teacher, programmer and web developer