karthik
Answered On : Sep 15th, 2006
#include<stdio.h>
main()
{
int n;
printf("Enter 1 or 2");
scanf("%d",&n);
switch(n)
{
case 1:
{
printf("hai");
break;
}
case 2:
{
printf("hello");
break;
}
default:
{
printf("enter 1 0r 2");
break;
}
}
}
Login to rate this answer.
milind patil
Answered On : Sep 26th, 2006
#include<stdio.h>
#include<conio.h>
main()
{
int a=15,b=7,r,no;
printf("1.addition 2.subraction 3.exit");
scanf("%d",&no);
switch(no)
{
case 1: //for addition
{
r=a+c;
printf("%d",r);
break;
}
case 2:
{
r=a-c;
printf("%d",r);
break;
}
default:
{
break;
}
}
}
Login to rate this answer.
praveen tiwari vaishnav mcm
Answered On : Oct 14th, 2006
#include#includevoid main(){int ch;printf("enter the no");scanf("%d",&ch);switch(ch){case 1: printf(" amerika" ); break;case 1: printf("indore"); break;defoult : printf("no value"); }
Login to rate this answer.
Riquelme
Answered On : Mar 12th, 2007
Brankets "{}" are not necessary in case branches, since switch-case is straight flow structure. Thanks.
Login to rate this answer.