C Program To Implement The Switch Case That perform the Addition, Subtraction, Multiplication and Division .





ALGORITHM:-

step 1 : Start
step 2 : Define variable(Mul, Div, Add, Sub)
step 3 : Input An Character
step 4 : Perform the Airthmatic Operation According to input character(+,-,*,/)
step 5 : Display the Result
step 6 : Stop the Execution

PROGRAM CODE:-

#include<stdio.h>
#include<conio.h>
int main()
{
    int choice, a, b;
    int sum, div, mul, sub;
    char c= 'y';

    while(c=='y')
    {
         printf("\nAdd  -> 1\nSub  -> 2 \nMulti  -> 3 \nDiv  -> 4\n");
         printf("\aEnter choice -: \n");
         scanf("%d",& choice);
         printf("\a\nEnter two number :- \n");
         scanf("%d%d",&a,&b);
         switch(choice)
         {

              case 1: sum = a + b;
              printf("\a\n Sum = %d", sum);
              break;

              case 2: sub = a - b;
              printf("\a\n Difference = %d", sub);
              break;

              case 3: mul = a * b;
              printf("\a\n Multiplication = %d", mul);
              break;

              case 4: div = a / b;
              printf("\a\n Division = %d", div);
              break;

              default : printf("\aWRONG CHOICE");
        }
        printf("\nDo you want to continue [y / n]");
        c=getch();
    }
    getch();
}
OUTPUT:-

Add -> 1
Sub -> 2
Mul -> 3
Div -> 4

Enter Choice: 1
Enter Two Number: 
10 20
Sum = 30

Do you want to Continue [y / n]: y

Enter Choice: 3
Enter Two Number: 
5 6
Mul = 30

Do you want to Continue [y / n]: n

C Program To Implement Selection Sorting
Write a Program to Sort an Array Using Selection Sort
Sort data Element of an array using selection