C
c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//General calculator
#include <stdio.h>
//created by amrendra kr singh
int main() {
//you can change the value of num1 & num2
double num1, num2;
//enter the operater only (+-*/)
char op;
printf ("first enter the num1 and oprater and after all enter second num2 :");
scanf("%lf %c%lf",&num1,&op,&num2);
/* you can enter any real number as a *input of num1 & num2
*/
if (op=='+'){
printf ("\n%lf + %lf = %lf ",num1, num2,num1+num2);
}
else if (op=='-')
{
if (num1 >num2 )
{printf ("\n%lf -%lf = %lf",num1 , num2 ,num1 - num2 );}
else
{
printf ("\n%lf -%lf= - %lf",num2 , num1 ,num2 - num1);
}}
else if (op=='/'){
printf ("\n%lf / %lf = %lf ",num1, num2,num1/num2);
}
else if (op=='*'){
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run