Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  cal
Language: C/C++
Code:
#include<stdio.h>
 
int main() {
    char operatr;
    float num1,num2;
     
    printf("Enter value of a\n");
    scanf("%f",&num1);
    printf("Enter value of b\n");
    scanf("%f",&num2);
    printf("Enter an arithemetic operatr(+-*/)\n");
    scanf("%c",&operatr);
 
    switch(operatr) {
        case '+': 
            printf("%f+%f = %f",num1, num2, num1+num2);
            break;
        case '-':
                printf("%f-%f = %f",num1, num2, num1-num2);
                break;
        case '*':
                printf("%f * %f = %f",num1, num2, num1*num2);
                break;
        case '/':
                printf("%f / %f = %f",num1, num2, num1/num2);
                break;
        default: 
                printf("ERROR: Unsupported Operation");
    
     
    return 0;
}
}
Comments: