Answer to Question #191857 in C++ for VARUN

Question #191857

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"


1
Expert's answer
2021-05-11T07:47:32-0400
#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";

}



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