write a program to all arithmetic operation using switch case in C

 //write a program to all arithmetic operation using switch case

#include <stdio.h>

int main()

{

int a,b;

int op;

printf(" 1.Addition\n 2.Substraction\n 3.Multiplication\n 4.Division\n");

printf("Enter the value of a & b: ");

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

printf("Enter your choice: ");

scanf("%d", &op);

switch(op)

{

case 1 :

printf("Sum of %d and %d is: %d",a, b, a+b);

break;

case 2 :

printf("Difference of %d and %d is: %d", a, b, a-b);

break;

case 3 :

printf("Multiplication of %d and %d is: %d", a, b, a*b);

break;

case 4:

printf("Division of two number is %d: ",a/b);

break;

default:

printf("Enter your correct choice." );

break;

}

return 0;

}


Comments

Popular posts from this blog

Automations and robotics

Solid Pattern Program In Java Language

Palindrome Pattern Program In Java Language