Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Stimulate calculators to perform addition,subtraction,multiplication and division on two numbers using if/else statement?

Answer Posted / guest

void main()
{
int n,a,b;
sanf("%d%d",&a,&b);
printf("select one of these");
printf("1.addition
2.subtraction
3.multiplication
4.division");
scanf("%d",&n);
if(n==1)
{
printf("%d",a+b);
}
else if(n==2)
{
printf("%d",a-b);
}
else if(n==3)
{
printf("%d",a*b);
}
else if(n==4)
{
printf("%d",a/b);
}
else
{
printf("nothing to print");
}
}

Is This Answer Correct ?    13 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Here is a good puzzle: how do you write a program which produces its own source code as output?

1079


Write a program to generate random numbers in c?

1082


What are the advantages and disadvantages of pointers?

1058


write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?

2121


Are the variables argc and argv are always local to main?

1011


define string ?

1090


What is register variable in c language?

1017


main use of recursive function a) processing speed high b) reduce program length/reduce repeated statements c) if you do not, use iterative methods like, for, while or do-while d) all the above

1072


What is wrong with this program statement?

1024


Explain is it valid to address one element beyond the end of an array?

1191


How can I split up a string into whitespace-separated fields?

1046


What does %2f mean in c?

1196


How does struct work in c?

1062


Why structure is used in c?

1174


What is the ANSI C Standard?

1252