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