function problem

Thread Starter

TAKYMOUNIR

Joined Jun 23, 2008
352
k=fu(x); i have problem with this function in the code the value is zero all the time can you please see what is wrong

Rich (BB code):
#include<stdio.h>
#include<math.h>
double area(double x,double y);
int fu(int l);
int main(){
double x ,y ,z,k;
printf("enter two number");
scanf("%lg%lg",&x,&y);
z=area(x,y);
k=fu(x);
printf("area is z =%lg and k is%d",z,k);
return 0;

}
double area(double x,double y){
double z;
z=x*y;
return z;}
int fu(int l){
return l+l;}
 

Attachments

Last edited by a moderator:

takao21203

Joined Apr 28, 2012
3,702
What software are you using?

I strongly suggest to use the debugger in single-step mode.

Then OP could write "I used the debugger, the variable a obtained the value blabla, but then in the line containing the code foobar, it is changing to 12345, and I don't properly understand why.

This is called "isolating the problem".

It is still a small piece of code. But confronting readers of a forum post with code; without explanation how it has been worked at, what happened, what exactly is unclear, at times can be rude.

OP write the value is zero at all times. Great. Some explanation.
In which line do you expect it to change to what value, and why? And what happened instead?
 

John P

Joined Oct 14, 2008
2,068
how can i post like this
What did you find when you looked at the note "Sticky: Use of CODE tags" at the top of this section? And the use of capital letters and punctuation would make your messages easier to read.

One thing I saw in your code was an attempt to print a C double quantity with a %d format.
 
Top