PROJECT Simple Smart Calculator in C programming language
Code :
#include<stdio.h>
#include<conio.h>
void add()
{
int a,b,c;
printf("enter two number\n");
scanf("%d%d",&a,&b);
c=a+b;
printf("the sum is :%d\n",c);
}
void sub()
{
int a,b,c;
printf("enter two number\n");
scanf("%d%d",&a,&b);
c=a-b;
printf("the subtraction is :%d\n",c);
}
void div()
{
int a,b,c;
printf("enter two number\n");
scanf("%d%d",&a,&b);
c=a/b;
printf("the division is :%d\n",c);
}
void mul()
{
int a,b,c;
printf("enter two number\n");
scanf("%d%d",&a,&b);
c=a*b;
printf("the multiplication is :%d\n",c);
}
void main()
{
while(1)
{
printf("--------------------Simple Smart Calculator-------------------\n");
printf(" 1.Addition Two number\n ");
printf("2.Subtraction Two number\n ");
printf("3.Division \n ");
printf("4.Multiplication Two number\n ");
printf("5.Exit\n ");
printf("--------------------------------------------------------------\n");
int num;
printf("Enter the operation Number\n ");
scanf("%d",&num);
switch(num)
{
case 1:
add();
break;
case 2:
sub() ;
break;
case 3:
div();
break;
case 4:
mul();
break;
default:
printf("operation does not exist\n");
break;
case 5:
exit(0);
}
}
getch();
}
0 Comments