Write a switch statement that will examine the value of an integer variable called flag and print one of the following messages, depending on the value assigned to flag. 1. HOT, if flag has a value of 1 2. LUKE WARM, if flag has value of 2 3. COLD, if flag has value of 3 4. OUT OF RANGE, if flag has any other range

Posted: September 23, 2012 in CSE Sem1, Lab 11B
#include<stdio.h>
int main()
{
	int choice;
		scanf("%d",&choice);
		switch(choice)
		{
			case 1:
			printf("HOT");
			break;
			case 2:
			printf("LUKE WARM");
			break;
			case 3:
			printf("COLD");
			break;
			default:
			printf("OUT OF RANGE");
		}
	return 0;
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s