LEC:5, if -else conditions
Source Code:
/* IF ELSE CONDITION IN c++ if(conditions) { statements going to be run; } else { statements; } */ #include<iostream> using namespace std; void age() { int n; cout<<"Plz enter your age: "; cin>>n; if(n>18) { cout<<"\nyour are eligible.."; } /* else { cout<<"\nyour are not eligible.."; }*/ } //nested if-else statements; void ABC() { int a,b,c; cout<<"plx enter the value of a,b and c"; cin>>a>>b>>c; if(a>b && a>c) { cout<<"a is greater"; } else if(b>c && b>a) { cout<<"b is greater"; } else { cout<<"c is greater"; } } int main() { ABC(); //age(); return 0; } |
Comments
Post a Comment