# Arithmetic calculator using switch statement

#include#include void main() { int choice, no1, no2, result; clrscr(); printf("\n\n*********************"); printf("\nArithmetic Calculator"); printf("\n*********************"); printf("\n\n1. Addition\n2. Subtraction"); printf("\n3. Multiplication\n4. Division"); printf("\n\nEnter your choice: "); scanf("%d",&choice); switch(choice){ case 1: printf("\nEnter the two number:"); scanf("%d %d", &no1, &no2); result = no1 + no2; printf("\nThe Addition of %d and %d is %d", no1, no2, result); break; case 2: printf("\nEnter the two number:"); scanf("%d %d", &no1, &no2); result = no1 - no2; printf("\nThe Subtaction of %d and %d is %d", no1, no2, result); break; case 3: printf("\nEnter the two number:"); scanf("%d %d", &no1, &no2); result = no1 * no2; printf("\nThe Multiplication of %d and %d is %d", no1, no2, result); break; case 4: printf("\nEnter the numerator and denominator:"); scanf("%d %d", &no1, &no2); if(no2 == 0){ printf("\nError: cannot divide by zero"); } else{ result = no1 / no2; printf("\nDivision of %d by %d is %d", no1, no2, result); } break; } getch(); }

**Output:**

********************* Arithmetic Calculator ********************* 1. Addition 2. Subtraction 3. Multiplication 4. Division Enter your choice: 4 Enter the numerator and denominator:5 0 Error: cannot divide by zero

now where’s your division ? if denominator is not zero..:)

Thanks buddy… 🙂

I really like your working.

i like it.

amazing

its nice nd easy to learn

you r good

you do best

Thanks .. nice program for beginners.