Write a C++ program to accept percentage and print division accordingly.

Q22. Write a C++ program to accept percentage and print division accordingly.

Solution:

#include<iostream.h> //standard input/output header file

#include<conio.h> //for clrscr()

 

int main()

{

int per;

 

clrscr(); //for clearing the screen

 

cout<<“\n Enter the percentage: “;

cin>>per;

 

per>=60? cout<<“\n I Division.” : per<60&&per>=45? cout<<“\n II Division.” :per>=36? cout<<“\n III Division.” : cout<<“\n Fail.”;

 

getch(); //holds the screen until any key is pressed

return 0; //makes main() finish

}

 

OUTPUT:

CASE 1:

Enter the percentage: 78

 

I Division.

 

CASE 2:

Enter the percentage: 57

 

II Division.

 

CASE 3:

Enter the percentage: 33

 

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: