I need help with this C code !!

I am trying to write an equation which is

In a code and here is the code but I keep getting the same output (0.000000)

Even though I tried to switch all variables type that are double to int except v , and I tried writing v=((double)1/3)…… and I tried v=(1.0/3.0)

but nothing worked! So please can you help me with this :heart:

The problem is the way the 1/3 is being evaluated in the assignment statement. Did you try substituting 0.33 and see if you get the correct answer. If you break apart the components that make up v individually you will see why the answer is zero.


Remember order of operations, the computer is seeing 1/(3piH*(R1 +r1*r2+R2).
Like the above answer, if it’s just an approximate you need do 0.33, or isolate the 1/3 : (1/3) * Pi *H…

1 Like

Hi @yara, did you solve this?