Multiple if else Statement in C++
Master C++ with Real-time Projects and Kickstart Your Career Start Now!!
Program 1
// Program for Nested if else
#include<iostream>
#define clrscr() system("cls")
using namespace std;
int main()
{
int a,b,c;
cout<<"Enter three number";
cin>>a>>b>>c;
if(a>b && a>c)
cout<<"Grater number is "<<a;
else
if(b>c)
cout<<"Grater number is "<<b;
else
cout<<"Grater number is "<<c;
//Program for Word format
// if(n==1)
// cout<<"One";
// else
// if(n==2)
// cout<<"Two";
// else
// if(n==3)
// cout<<"Three";
// else
// if(n==4)
// cout<<"Four";
// else
// if(n==5)
// cout<<"Five";
// else
// cout<<"Invalid Number";
//Program for Vowel
// char ch;
// cout<<"Enter a character";
// cin>>ch;
// if(ch=='a' || ch=='A')
// cout<<"Vowel";
// else
// if(ch=='e' || ch=='E')
// cout<<"Vowel";
// else
// if(ch=='i' || ch=='I')
// cout<<"Vowel";
// else
// if(ch=='o' || ch=='O')
// cout<<"Vowel";
// else
// if(ch=='u' || ch=='U')
// cout<<"Vowel";
// else
// cout<<"Consonent";
return 0;
}
Did you like our efforts? If Yes, please give DataFlair 5 Stars on Google

