// simple calculator
#include<stdio.h>
#include<conio.h>
void main()
{
int n,a,b,c;
int p,r,t;
float si;
printf("\t\t******SIMPLE CALCULATOR MADE BY AK DAS******");
do
{
//printf("\n******SIMPLE CALCULATOR MADE BY AK DAS******");
printf("\n\nenter 1 for addition");
printf("\nenter 2 for substraction");
printf("\nenter 3 for multiplication");
printf("\nenter 4 for division");
printf("\nenter 5 for square");
printf("\nenter 6 for quib");
printf("\nenter 7 for simple instrest ");
printf("\nenter 8 for modules");
printf("\nenter 9 for odd or even ");
printf("\nenter 10 for exit\n");
printf("\nenter your choice\n");
scanf("%d",&n);
switch(n)
{ // starting point of switch case
case 1:
printf("\nenter two numbers");
scanf("%d%d",&a,&b);
c=a+b;
printf("\nsum of %d\n",c);
break;
case 2:
printf("\nenter two numbers");
scanf("%d%d",&a,&b);
c=a-b;
printf("\nsubstraction of %d\n",c);
break;
case 3:
printf("\nenter two numbers");
scanf("%d%d",&a,&b);
c=a*b;
printf("\nmultiplication of %d\n",c);
break;
case 4:
printf("\nenter two numbers");
scanf("%d%d",&a,&b);
c=a/b;
printf("\ndivision of %d\n",c);
break;
case 5:
printf("\nenter your numbers");
scanf("%d",&a);
c=a*a;
printf("\nsquare of %d\n",c);
break;
case 6:
printf("\nenter your numbers");
scanf("%d",&a);
c=a*a*a;
printf("\nquib of %d\n",c);
break;
case 7:
//int p,r,t;
//float si;
printf("\nenter your p,r,t");
scanf("%d%f%d",&p,&r,&t);
si=(p*r*t)/100;
printf("\nsimple instrest is %d\n",si);
break;
case 8:
printf("\nenter two numbers");
scanf("%d%d",&a,&b);
c=a%b;
printf("\nmodules of %d\n",c);
break;
case 9:
printf("\nenter any number");
scanf("%d",&a);
if(a%2==0)
printf("even no.\n");
else
printf("odd no.\n");
break;
case 10:
exit(0);
default:
printf("\nplease enter right input");
}
} // end of switch case
while(1);
getch();
} // end of main program
Comments
Post a Comment