Help I just started c programming I am an absolute noob

So I wrote this programe but I am getting the wrong output

!

This is the programme

The problem is that you have a semicolon after for (...). That way the semicolon (empty instruction) becomes the loop body, and the printf() call is executed after the loop terminates. f = 320 is the first value of f for which f <= 300 fails.

Try to find an editor/IDE that can do autoindenting, when the printf() call is indented to the same level as the for you’ll know something is wrong. :wink:

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.

2 Likes

Thanks, it was a screenshot cuz I couldn’t copy paste from jdoodle.

1 Like