So I wrote this programe but I am getting the wrong output
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.
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.
Thanks, it was a screenshot cuz I couldn’t copy paste from jdoodle.