Answer to Question #174874 in C++ for K.PRAKASA

Question #174874

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


1
Expert's answer
2021-03-25T08:27:09-0400
#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;
    }


}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS