fcbsd

*BSD bod

  • he/him

OpenBSD on the Desktop,
since 2001

Glasgow

You must log in to comment.

in reply to @fcbsd's post:

ooh fun puzzle lemme see
it doesn't reset j in the check condition, so it prints the first 10 numbers on one line and then the next 90 on the second line
it's one indexed, which is clearly a horrible crime /s
oh but wait, i's loop condition is also 10 lmao, so it just prints the first ten, then a newline, then returns lmaooo
wait a second there's two i++ too! so it's gonna print the 1st, 3rd, 5th, 7th and 9th and not the newline
fantastic work llm you get a pizza trophy

expected output from my reading:
The first 100 square numbers are:
1 9 25 49 81

edit 1: oh shit I didn't even think that it's not going to hit the i loop until it breaks the j loop...which is why it thought it'd get to 100 I guess lmao

shit I gotta revise this

edit 2: so I was right the first time, it's just going to print 10 squares and then a newline, then the j condition breaks, and then the i condition breaks, so it returns. so the i loop is useless except that it initializes i.

I think if the outside loop was
for (i = 1; i <= 100; ; )
this code might work? of course this is just a while loop at that point, just initialize upon declaration. gotta remove the loop's increment or else it'll skip a square at the start of every line. and the i > 100 is useless

to be clear, yeah, don't run LLM code, don't ask LLMs for code, etc, I'm just exploring this as a puzzle.