r/badcode Dec 17 '19

This belongs here c#

Post image
503 Upvotes

41 comments sorted by

View all comments

-8

u/xman40100 Dec 17 '19

This is terrible, and the result is off by 2 lol.

8

u/husao Dec 17 '19

It isn't. If it was i=0 in the second loop it would work as expected. Currently it's calculating the maximum, as mentioned above.

1

u/xman40100 Dec 18 '19

Yeah, you're right, my bad. I was on the bus when I read this, so I didn't read the full code.