Advertisement
Advertisement
/* nested if-else example */
#include<iostream>
using namespace std;
int main()
{
if(9<10)
{
if(9<8)
cout<<"9 is less than 10 & 99 is also less than 8";
else
cout<<"9 is less than 10 but 9 is not less than 8";
}
else
cout<<"9 is not less than 10";
return 0;
}
9 is less than 10 but 9 is not less than 8
//* nested if-else example */
#include<iostream>
using namespace std;
int main()
{
if('a'<'b')
{
if(9>8)
cout<<"a is less than b and 9 is greater than 8";
else
cout<<"a is less than b and 9 is less than 8";
}
else
cout<<"a is not less than b";
return 0;
}
a is less than b and 9 is greater than 8
Advertisement
Advertisement
Please check our latest addition
C#, PYTHON and DJANGO
Advertisement