Answer to Question #208397 in C# for Swetha

Question #208397

Question :

Develop a C program to get the temperature and print the following status according to the given temperature by using else if ladder statement.





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-06-18T08:24:29-0400
#include <stdio.h>
#include <stdlib.h> 


int main()
{
	float temperature;
	// get the temperature 
	printf("Enter temperature: ");
	scanf("%f",&temperature);
	//1. T<=0 "Its very very cold".
	if(temperature<=0){
		printf("\nIts very very cold\n");
	}else if(temperature>0 && temperature<=10){
		//2. 0 > T < 10 "Its cold".
		printf("\nIts cold\n");
	}else if(temperature>10 && temperature<=20){
		//3. 10 > T < =20 "Its cool out".
		printf("\nIts cool out\n");
	}else if(temperature>20 && temperature<=30){
		//4. 20 > T < =30 "Its warm".
		printf("\nIts warm\n");
	}else if(temperature>30){
		//5. T>30 "Its hot".
		printf("\nIts hot\n");
	}


	getchar();
	getchar();
	return 0;
}




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