Ask coding questions

← Back to all posts
multiply
Bunnytoes (165)

Why won't this work? if you do 1000 and 1000 it doesn't work

Comments
hotnewtop
Coder100 (18902)

might i suggest the ulong type instead? The biggest baddest number you can get in C#!!

Bunnytoes (165)

@Coder100 I tried ulong but it had an error

Coder100 (18902)

@Bunnytoes no
you weren't supposed to remove the code!

Coder100 (18902)

you removed the long type for ulong? @Bunnytoes

Coder100 (18902)

niceee
so is it better now @Bunnytoes

Bunnytoes (165)

@Coder100 yes but it still sometimes doesn't work

InvisibleOne (3208)

You reached the max possible number for the integer type your using, or at least that's what the Microsoft docs say.

Bunnytoes (165)

@InvisibleOne I tried to stop it for while (i < Int64.MaxValue) but that didn't work

InvisibleOne (3208)

Yeah, the issue is that the number is ok when that checks it, but then it goes one higher and that's what is breaking it. Maybe change that to
while ((i*=j) < Int64.MaxValue) { but I'm not 100% sure that will work. @Bunnytoes

IMayBeMe (542)

It could be due to the max number size being reached therefore breaking the program.

ruiwenge2 (1131)

it does work though

ruiwenge2 (1131)

ohh…the later numbers are different