Develop a C++ program to get the temperature and print the following status according to the given temperature by using else if ladder statement. [Note: Use call by value]
1. T<=0 "Its very very cold"
2. 0 < T <=10 "Its cold"
3. 10 < T < =20 "Its cool out"
4. 20 < T < =30 "Its warm"
5. T>30 "Its hot
#include<iostream>
using namespace std;
int main(){
int T;
cout<<"enter T="<<endl;
cin>>T;
if(T<=0){
cout<<"Its very very cold"<<endl;
}
else if(T<=10 && T>0){
cout<<"Its cold"<<endl;
}
else if(T<=20 && T>10){
cout<<"Its cool out"<<endl;
}
else if (T<=30 && T>20){
cout<<"Its warm"<<endl;
}
else {
cout<<"Its hot"<<endl;
}
}
Comments
Leave a comment