Switch Case
Switch Case Example for Simple Arithmetic Operations The source code illustrating the use Switch Case Example for Simple Arithmetic Operations - Addition, Subtraction, Multiplication and Division are given on this page. Source Code #include <stdio.h> void main() { int opcode; int a, b; int result; printf( "Program for Addition, Subtraction, Multiplication and Division\n" ); printf( "Enter Your Choice: 1 - Add, 2 - Sub, 3 - Mul, 4 - Div: " ); scanf( "%d" , &opcode); printf( "Enter First Number:" ); scanf( "%d" , &a); printf( "Enter Second Number:" ); scanf( "%d" , &b); switch (opcode) { case 1: result = a + b; printf( "%d + %d = %d" , a, b, result);