rendered paste body#include<stdio.h>
void main()
{
float a;
float b;
float c;
int calc;
clrscr();
printf("Welcome to My Simple Calculator!");
printf("\nPush Enter When Ready");
printf("\nEnter First Number :");
scanf("%f", &a);
printf("Enter Second Number :");
scanf("%f", &b);
printf("Enter Operation (1-4) (+,-,x,/)");
scanf("%d", &calc);
switch (calc)
{
case 1: c = sum(a,b);
break;
case 2: c = sub(a,b);
break;
case 3: c = multi(a,b);
break;
case 4: c = divide(a,b);
break;
default: printf("Invalid Character!");
}
printf("Result is %e", c);
}
float sum(float x, float y)
{
float r;
r = x + y;
return r;
}
float sub(float x, float y)
{
float r;
r = x - y;
return r;
}
float multi(float x, float y)
{
float r;
r = x * y;
return r;
}
float divide(float x, float y)
{
float r;
r = x / y;
return r;
}