source code, C/C++ Programming

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);
}

Posted Date: 7/15/2012 10:54:08 AM | Location : United States







Related Discussions:- source code, Assignment Help, Ask Question on source code, Get Answer, Expert's Help, source code Discussions

Write discussion on source code
Your posts are moderated
Related Questions
assume that the first integer read with cin specifies the number of values remaining to be entered. that program should read only one value each time cin is executed .a typical inp


make a marksheet of 2 student with 5 subject

replace character into string and return value of string that are replaced

Program to design text styles: Write a C program to design different text style char *fname[] = { "DEFAULT font",                                   "TRIPLEX font",


i need a program that generates this output: The highest card wins! Suit Order is: clubs, diamonds, hearts and spades The computers card is the 5 of Spades. The player’s card is t

A: It allows a program to reference an identifier in global scope which has been hidden by another identifier along with the same name in the local scope.


#an array that accept input and gives an output