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
How will you print TATA alone from TATA POWER using string copy and concate commands in C?
Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix
what are non standard function in c
What does s c mean on snapchat?
Explain what would happen to x in this expression: x += 15; (assuming the value of x is 5)
Why is c known as a mother language?
what is use of malloc and calloc?
What are the features of c language?
What are bitwise shift operators in c programming?
Explain how can you avoid including a header more than once?
how to create duplicate link list using C???
program to find error in linklist.(i.e find whether any node point wrongly to previous nodes instead of next node)
‘ C’ PROGRAME TO SHOW THE TYPE OF TRANGLE BY ACCEPTING IT’S LENGTH .
What is the difference between printf and scanf )?
How does placing some code lines between the comment symbol help in debugging the code?