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



Stimulate calculators to perform addition,subtraction,multiplication and division on two numbers usi..

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

Post New Answer

More C Interview Questions

Write a programe print the sum of series 0,1,2,.....10

7 Answers  


What is identifiers in c with examples?

0 Answers  


What should not contain a header file?

2 Answers  


Explain what are bus errors, memory faults, and core dumps?

0 Answers  


In c programming write a program that will print 10 multiples of 3 except 15,18,21 using looping

0 Answers  






Why is C language being considered a middle level language?

0 Answers  


What is the difference between null pointer and void pointer

10 Answers   CTS, Manforce, MAQ Software,


why r u join this company? give solid resons.

16 Answers   IBM, Infosys, TCS,


When would you use a pointer to a function?

0 Answers  


How can I swap two values without using a temporary?

0 Answers  


How to find the digits truncation when assigning the interger variable to the character variables. like int i=500; char x = i : here we have truncation. how to find this. another ex: i =100; char x=i. here we do not have truncation.

1 Answers   HCL,


Explain the concept and use of type void.

0 Answers  


Categories