Where is the simple error?

cquestion's Avatar
Go4Expert Member
Hello, i'm going mad because I can't find the problem in this simple code. Why do this don't work?
Code:
float promedi(a,b)
{
return ((a+b)/2);
}

main()
{
float x,y;
printf("Dame dos valores\n");
scanf("%f%f", &x, &y);
printf("%f",promedi(x,y));
system("pause");
}
I got at least two different errors (strange long number solutions, window must close...).

Last edited by shabbir; 6Dec2007 at 09:43.. Reason: Code block
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
float promedi(a,b) is not the right way of defining the function. it should be float promedi(float a, float b)
0
cquestion's Avatar
Go4Expert Member
Hello shabbir. Thanks a lot for your help . I'm sorry, I created two posts by mistake.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Quote:
Originally Posted by cquestion
Hello shabbir. Thanks a lot for your help . I'm sorry, I created two posts by mistake.
My pleasure