I need help with this C code !!


#1

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:


#2

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.