//Program to create simple Calculator using C concepts.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,r;
float f;
char ch,fun;
clrscr();
label:
printf("\n Please choose operation you want to perform ");
printf("\nPress + for the addition of the two numbers");
printf("\nPress - for the subtraction of the two numbers");
printf("\nPress * for the multiplication of the two numbers");
printf("\nPress / for the division of the two numbers");
printf("\n please enter your choice:");
fun=getche();
switch (fun)
{
case '+':
printf("\nPlease enter the first number which you want to add:");
scanf("%d",&a);
printf("\nPlease enter the second number:");
scanf("%d",&b);
r=a+b;
printf("%d + %d= %d",a,b,r);
break;
case '-':
printf("\nPlease enter the first number");
scanf("%d",&a);
printf("\nPlease enter the second number:");
scanf("%d",&b);
r=a-b;
printf("%d - %d= %d",a,b,r);
break;
case '*':
printf("\nPlease enter the first number:");
scanf("%d",&a);
printf("\nPlease enter the second number:");
scanf("%d",&b);
r=a*b;
printf("%d * %d= %d",a,b,r);
break;
case '/':
printf("\nPlease enter the first number :");
scanf("%d",&a);
printf("\nPlease enter the second number:");
scanf("%d",&b);
f=(float)a/b;
printf("%d / %d=%f",a,b,f);
break;
default:
printf(" you hve entered a wrong choice! please make sure that you are choosing accurate choice");
break;
}
printf("\n Wheather you want to perform some another function please enter your choice Y or N");
ch=getche();
if(ch=='y'||ch=='Y')
{
goto label;
}
else
{
printf(" \n you completed your calculations!!!!!!! thank u to use my program Bimal");
getch();
exit();
}
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,r;
float f;
char ch,fun;
clrscr();
label:
printf("\n Please choose operation you want to perform ");
printf("\nPress + for the addition of the two numbers");
printf("\nPress - for the subtraction of the two numbers");
printf("\nPress * for the multiplication of the two numbers");
printf("\nPress / for the division of the two numbers");
printf("\n please enter your choice:");
fun=getche();
switch (fun)
{
case '+':
printf("\nPlease enter the first number which you want to add:");
scanf("%d",&a);
printf("\nPlease enter the second number:");
scanf("%d",&b);
r=a+b;
printf("%d + %d= %d",a,b,r);
break;
case '-':
printf("\nPlease enter the first number");
scanf("%d",&a);
printf("\nPlease enter the second number:");
scanf("%d",&b);
r=a-b;
printf("%d - %d= %d",a,b,r);
break;
case '*':
printf("\nPlease enter the first number:");
scanf("%d",&a);
printf("\nPlease enter the second number:");
scanf("%d",&b);
r=a*b;
printf("%d * %d= %d",a,b,r);
break;
case '/':
printf("\nPlease enter the first number :");
scanf("%d",&a);
printf("\nPlease enter the second number:");
scanf("%d",&b);
f=(float)a/b;
printf("%d / %d=%f",a,b,f);
break;
default:
printf(" you hve entered a wrong choice! please make sure that you are choosing accurate choice");
break;
}
printf("\n Wheather you want to perform some another function please enter your choice Y or N");
ch=getche();
if(ch=='y'||ch=='Y')
{
goto label;
}
else
{
printf(" \n you completed your calculations!!!!!!! thank u to use my program Bimal");
getch();
exit();
}
getch();
}