Stimulate calculators to perform addition,subtraction,multiplication and division on two numbers using if/else statement?
Answer / 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 |
What are the valid places to have keyword “break”?
Between macros and functions,which is better to use and why?
Is printf a keyword?
What are volatile variables?
What is the process to generate random numbers in c programming language?
what is the use of getch() function in C program.. difference b/w getch() and getche()??
29 Answers HCL, IBM, Infosys, TCS, Wipro,
write a C and C++ programme to implement the A,bubble sort B,quick sort C,insertion sort D,sequential search E,binary search
What is static volatile in c?
How does C++ help with the tradeoff of safety vs. usability?
write a program to swap Two numbers without using temp variable.
75 Answers EMC, Focus, GreyB, HCL, Hitech, HP, Huawei, Infosys, Mannar Company, Microsoft, Miles Software, Odessa Technologies, Satyam, TCS, Wipro,
A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference
What is the difference between procedural and functional programming?