C program for making your on own calculator.

C program for entering numbers and operators to calculate their output.

#include<stdio.h>
int main()
{
    float a,b,c;
    char f;
    printf("enter any no\n");
    scanf("%f",&a);
    printf("enter the operation + * - /");
    scanf(" %c",&f);
    printf("\nenter the second number\n");
    scanf(" %f",&b);
    switch (f)
    {
    case '+':
     c=a+b;
     break;
    case '*':
     c=a-b;
    break;
    case '-':
     c=a-b;
    break;
    case '/':
     c=a/b;
    break;
    default:
     printf("you have entered operations other than + - * /");
    break;
    }
      printf("answer is %f",c);

  return 0;
} 


This is a program for making a calculator.



Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.