0
1.5kviews
Write a program to implement calculator with following operations using switch case

a. Add two numbers

b. Subtract two numbers

c. Multiply two numbers

d. Divide two numbers

1 Answer
0
13views

Program:

#include<stdio.h>
#include<conio.h>

int main() {
    float a,b,c;
    int d;
    char c;
    clrscr();

    printf("\n\n\t Simple Calculator");
    fflush(stdin);

    printf("\n\n\t Enter + Add - Sub * Mul / div % div(R)");
    scanf("%c", &c1);

    switch(c1) {
        case '+': 
            printf("\n\n\t Enter two numbers");
            scanf("%f %f", &a, &b);
            c = a + b;
            printf("\n\n\t Addition …

Create a free account to keep reading this post.

and 2 others joined a min ago.

Please log in to add an answer.