How can I calculate it in C?

20X(77^2) mod 119

It's too big... even can't use pow/%/mod.....

thx!!

Printable View

- 02-11-2002DramaKingMod question...
How can I calculate it in C?

20X(77^2) mod 119

It's too big... even can't use pow/%/mod.....

thx!! - 02-11-2002DramaKingSorry...
Sorry... I posted wrongly... it should be in C Programming section...

Pls del it..... sorry..... - 02-11-2002Unregistered
20(77*77) is about 118000 which is too big for an int but should work OK for a long.

You could try decreasing the result by a factor of ten to get it into the range of int, Do your modulo, then multiple the result by a random number between 1 and 10 to get it back up to a higher value if you want. - 02-11-2002DramaKingQuote:

*Originally posted by Unregistered*

**20(77*77) is about 118000 which is too big for an int but should work OK for a long.**

You could try decreasing the result by a factor of ten to get it into the range of int, Do your modulo, then multiple the result by a random number between 1 and 10 to get it back up to a higher value if you want.

thx a lot!!! :D