This problem made me confused

#include <cstdio>
double mul(double a, double b);

int main()
{
double a, b=0.45, c;
printf("Enter the weight in Pound: ");
scanf("%d", &a);
c=(a,b);
printf("The weight in KG is %lf",c);
}
double mul(double a, double b)
{
return(a*b);
}

When I put any number in there. The result is still 0.45
How come it could be that?
number one, why are you making a multiply function?

is * too much to type?

Number two, you aren't even using the function...
Yea, I'm try to make multiply function. Can you give me some ideas for this problem?
Well I can tell that's what you're doing.... in your case where you have c = (a,b) I'm guessing you are trying to use your mul() function.

Simply put a mul in front and you're golden. Is there a particular reason you're making a multiply function?
a. main function
i. Asks the user for someone’s weight in pounds
ii. calls a function that takes the weight and returns its equivalent in Kilograms
iii. Display the weight
b. pound convertor
i. takes the weight in pounds and converts it to kilogram
ii. returns the weight in kilograms

This is the reason why I'm making a multiply function
You don't understand, if it simply multiplies two numbers it's completely unnecessary. Just use * however if it actually serves some functionality you may want to consider a name change.

anyway your code is in c, not c++

Topic archived. No new replies allowed.