-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconditionalstmt.cpp
More file actions
24 lines (21 loc) · 823 Bytes
/
Copy pathconditionalstmt.cpp
File metadata and controls
24 lines (21 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include<iostream>
#include<cstdio>
using namespace std;
/*there are two conditional statements in c++ if and else
they can be given condtions using relational operators or logical operators
realtional operators - >=,==,<=,!=
logical operators - &&(and),!(not),||(or) they are used to write compound conditional statemnts */
//lets take an example for the compound conditional statement where we have to decide if the age entered is young or not
//young age should be between 12 to 50
int main(){
int age;
cout<<"enter a age :"<<endl;
cin>>age;
if(age>=12 && age<=50){
cout<<"the age entered is young";
}
else{
cout<<"the age entered is not young";
}
return 0;
}