Write a Program of Decision making statements using If Else If.

IF Else If Statement is conditional statements,we can call also Ladder If Else or if else switch, work if Condition is true If Part Statement Code is Working Else check another if or Else Part.

if Condition is False ,Else if condition checking.

Flow

if(condition){

Statement

}else if(condition){

Statement

}else{

Statement

}

Program 

 

//Write a Program of Decision making statements using If Else If
#include<iostream.h>
#include<conio.h>
void main(){
clrscr();
int marks=0;
cout<<" If-Else-If Program ";
cout<<"\n -----------------";
cout<<"\n Enter Marks : ";
cin>>marks;
// A B C D E F
if(marks>100){
cout<<"\n Marks is In-Valid ";
}else if(marks>=80 && marks<=100){
cout<<"\n Grade is A";
}else if(marks>=60 && marks<80){
cout<<"\n Grade is B";
}else if(marks>=40 && marks<=60){
cout<<"\n Grade is C";
}else if(marks>=20 && marks<=40){
cout<<"\n Grade is D";
}else{
cout<<"\n Grade is F";
}
getch();
}

Output / Result

(Visited 166 times, 1 visits today)
Share with Friends :
Written by:

Leave a Reply

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