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 disadvantages of C language.
How to write a code for reverse of string without using string functions?
Why c is faster than c++?
why we use "include" word before calling the header file. is there any special name for that include??????
#define min((a),(b)) ((a)<(b))?(a):(b) main() { int i=0,a[20],*ptr; ptr=a; while(min(ptr++,&a[9])<&a[8]) i=i+1; printf("i=%d\n",i);}
When should the volatile modifier be used?
if the address of a[1,1] and a[2,1] are 1000 and 1010 respectively and each occupies 2 bytes then the array has been stored in what order?
4 Answers Amazon, Apple, Bata, Google, NASA,
without using arithmatic operator convert an intger variable x into x+1
how to count no of words,characters,lines in a paragraph.
Why do we need arrays in c?
Is main an identifier in c?
Explain how do you search data in a data file using random access method?