Help I just started c programming I am an absolute noob #21487
-
So I wrote this programe but I am getting the wrong output ! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
This is the programme |
Beta Was this translation helpful? Give feedback.
-
The problem is that you have a semicolon after Try to find an editor/IDE that can do autoindenting, when the And in the future when posting code, please use a markdown code block (enclosed in ```) instead of screenshots, it’s much easier to read that way. |
Beta Was this translation helpful? Give feedback.
-
Thanks, it was a screenshot cuz I couldn’t copy paste from jdoodle. |
Beta Was this translation helpful? Give feedback.
The problem is that you have a semicolon after
for (...)
. That way the semicolon (empty instruction) becomes the loop body, and theprintf()
call is executed after the loop terminates.f = 320
is the first value off
for whichf <= 300
fails.Try to find an editor/IDE that can do autoindenting, when the
printf()
call is indented to the same level as thefor
you’ll know something is wrong. 😉And in the future when posting code, please use a markdown code block (enclosed in ```) instead of screenshots, it’s much easier to read that way.