Earn by twitter on twivert

Sign up for PayPal and start accepting credit card payments instantly.

Sunday, December 27, 2009

WAP to use switch control in C

/*switch control*/
#include
#include
void main()
{
int choice,sum,sub,multi,div,rem,a,b,y;
clrscr();
n:printf("enter ur choice\n1. sum\n2. sub\n3.multi\n4.div\n5.rem\n6. stop");
scanf("%d",&choice);
p:switch(choice)
{
case 1:printf("\ne.two no.");
scanf("%d%d",&a,&b);
sum=a+b;
printf("%d",sum);
printf("\ndo u want continue\npress1 for YES\npress2 for NO");
scanf("%d",&y);
if(y==1)
goto p;
else
goto n;
break;
case 2:printf("\ne.two no.");
scanf("%d%d",&a,&b);
sub=a-b;
printf("%d",sub);
printf("\ndo u want continue\npress1 for YES\npress2 for NO");
scanf("%d",&y);
if(y==1)
goto p;
else
goto n;
break;
case 3:printf("\ne.two no.");
scanf("%d%d",&a,&b);
multi=a*b;
printf("%d",multi);
printf("\ndo u want continue\npress1 for YES\npress2 for NO");
scanf("%d",&y);
if(y==1)
goto p;
else
goto n;
break;
case 4:printf("\ne.two no.");
scanf("%d%d",&a,&b);
div=a/b;
printf("%d",div);
printf("\ndo u want continue\npress1 for YES\npress2 for NO");
scanf("%d",&y);
if(y==1)
goto p;
else
goto n;
break;
case 5:printf("\ne.two no.");
scanf("%d%d",&a,&b);
rem=a%b;
printf("%d",rem);
printf("\ndo u want continue\npress1 for YES\npress2 for NO");
scanf("%d",&y);
if(y==1)
goto p;
else
goto n;
break;
case 6:printf("\nbye");
}
getch();
}

No comments:

Post a Comment

ADS

How to earn online

How to earn online:
Step - 1 :
signup for PayPal, to recieve your online earning
click here:
https://www.paypal.com/in/mrb/pal=CZ7224TZBMCBL
step - 2 : Singup these 4 sites & earn & enjoy! Read site to know how to earn.
1. trekpay
Earn up to $0.02 (2 cents) per click.
http://www.trekpay.com/?ref=34690
2. neobux
Earn up to $0.02 (2 cents) per click.
Click here:
http://www.neobux.com/?r=Moneyearner786

AddMe

Bookmark and Share