Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create calculator for using C #356

Open
Kiranugale90 opened this issue Sep 19, 2022 · 1 comment
Open

Create calculator for using C #356

Kiranugale90 opened this issue Sep 19, 2022 · 1 comment

Comments

@Kiranugale90
Copy link

#include<stdio.h>

int main()
{
   char op;//op is operator
   float first, second;

printf("Enter your operator(+,-,/,*)=\n");
  scanf("%c",&op);
printf("________________________________________\n");
printf("                  |\n");
printf("Enter first number=");
  scanf("%f",&first);
printf("                  |\n");
printf("Enter second number=");
  scanf("%f",&second);
printf("                  |\n");
 printf("________________________________________\n");


  

 

 switch (op){

   case '+':
    {
      printf("the addition is=  |%f", first+second);
      break;
    
    }
    case '-':
    {
      printf("the substraction is=%f", first-second);
      break;
    
    }
    case '*':
    {
      printf("the multiplication is=%f", first*second);
      break;
    
    }
    case '/':
    {
      printf("the division is=%f", first/second);
      break;
    
    }
     default:
    {
       printf("invalid operation");
    }

}


}
@Kiranugale90
Copy link
Author

Nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant