Friday, April 16, 2010

Use of Nested If

#include<iostream.h>
#include<conio.h>
 void main()
 {
 clrscr();
 int p;
 cout<<"enter percentage\n";
 cin>>p;
 if(p>=90)
 cout<<"S grade\n";
 else if(p>=80)
 cout<<"A grade\n";
 else if(p>=70)
 cout<<"B grade\n";
 else
 cout<<"C grade";
 getch();
 }

No comments:

Post a Comment