answersLogoWhite

0


Best Answer

#include<stdio.h>

#include<conio.h>

void main()

{

int a,b,c;

int menu;

printf("choose the arithmetic option\n");

scanf("%d",&menu);

switch(menu)

{

case 1:

printf("Enter The Two Numbers:\n");

scanf("%d%d",&a,&b);

c=a+b;

printf("The addition of two numbers %d\n",c);

break;

case 2:

printf("Enter THE TWO NUMBERS:\n");

scanf("%d%d",&a,&b);

c=a-b;

printf("The subtraction of two numbers %d\n",c);

break;

case 3:

printf("Enter THE TWO NUMBERS:\n");

scanf("%d%d",&a,&b);

c=a*b;

printf("The multiplication of two numbers %d\n",c);

break;

case 4:

printf("Enter THE TWO NUMBERS:\n");

scanf("%d%d",&a,&b);

c=a/b;

printf("The division of two numbers %d\n",c);

break;

}

getch();

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program in c for arithmetic operators by using switch case?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write an equivalence of switch statement and if statement?

switch(ch) { case '+': ....cout &lt;&lt;"arithmetic operator"; ....break; //&lt;===break is a must /// &lt;====================other cases . . default: // &lt;=======else }


Write a program in C for arithmetic operations between two integers your program should guide users with proper message or menu on the console?

Write a program in C for showing working of different logical operator in C.Your program should guide users with proper message/menu on the console. (5 Marks)


How you can write an account of prime numbers in arithmetic progressions?

There is no simple answer because there is no simple rule for primes: it is certainly NOT an arithmetic progression.


How do you write a c program when desktop is off?

With a text mode text editor. Or simply switch it on if the OS supports X windows.


Write a c plus plus program to find the largest among three numbers using ternary operators?

R = (A &gt; B &amp;&amp; A &gt; C) ? A : (B &gt; C) ? B : C; // parentheses not necessary - for clarity only


What is output if we don't write break statement in switch-case in c sharp?

This question cannot be generally answered, the output depends on the actual program.


Write aC program to find whether a given number is even or odd without using arithmetic operators?

#includemain(){int i,j; /*int type variables*/scanf("%d",i);/*read i value*/j=i&1; /*perform logical and operation to find 1at lsbif(j==0)printf("even");elseprintf("odd");getch();}One more example found at "c programming"web: cprogramming-bd.com/c_page4.aspx#ODD%20Numbers


What is the shell script program for adding five digit numbers?

It depends upon which language you intend to write your script, however 5 digit numbers are simply numeric value and any scripting language that supports basic arithmetic operators will be able to achieve this easily. The hardest part is converting the user input (which is typically a character sequence) into an actual number, however most scripting languages will provide some means of converting strings to numeric values.


Write a programme to perform binary operations on integer argument The arguments and operators should be accepted using command line parameters?

There are many different operators, which are you referring to?


How do you write a arithmetic operations in c using compound assignment statement?

a = b = c


How to write program for secant method in mathematica?

How to write a program for secant method by mathematica


How to write C program without operater?

// a complete C program without using any operators int main() { return 0; } // a non-useless program, which accepts a single command line argument and // prints whether or not the first character is a vowel int main(int argc, char** argv) { if(argc != 2) { return 1; } switch(argv[1][0]) { case 'a': case 'e': case 'i': case 'o': case 'u': printf("vowel\n"); break; default: printf("not vowel\n"); } return 0; }