I hv an assignment to do, I almost done. But i cant find whats wrong- my code is to make a simple calculator using function''s all 4 patterns. I did like this-
#include
int add (int, int);
int sub (void);
void mul (int, int);
void div (void);
int main()
{
int add, sub, mul, x, y;
float div;
printf("Enter the 1st number: ");
scanf("%d", &x);
printf("Enter the 2nd number: ");
scanf("%d", &y);
add;
{
printf("the sum is %d",add(x,y));
}
sub;
{
printf("the substraction is %d", sub());
}
mul(x,y);
div();
return 0;
}
int add (int x, int y)
{
int add;
add=x+y;
return add;
}
int sub (void)
{
int sub, x, y;
sub= (x-y);
return sub;
}
void mul (int x, int y)
{
int mul;
mul=(x*y);
printf("the product result is%d",mul);
}
void div (void)
{
int x, y;
float div;
div=(x/y);
printf("the division result is %f",div);
}