Monday, September 10, 2012

Switch case find Larger & Smaller Value


#include<stdio.h>
#include<conio.h>
void main()
{
char i;
int x,y;
clrscr();

printf("Enter X value");
scanf("%d",&x);
printf("Enter Y Value");
scanf("%d",&y);

printf("\n\nFor see Largest Number Enter L\n");
printf("For see Smaller Number Enter S");
printf("\n\nEnter Code");
scanf("%s",&i);

switch(i)
{
case 'l':
{
if(x>y)
{
printf("X is Large");
}
else
{
printf("Y is Large");
}
break;
}
case 's':
{
if(x<y)
{
printf("X is smaller");
}
else
{
printf("Y is smaller");
}
break;
}
}
getch();
}

No comments:

Post a Comment