Mod question...

This is a discussion on Mod question... within the C++ Programming forums, part of the General Programming Boards category; How can I calculate it in C? 20X(77^2) mod 119 It's too big... even can't use pow/%/mod..... thx!!...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    101

    Mod question...

    How can I calculate it in C?

    20X(77^2) mod 119

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

    thx!!

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    101

    Sorry...

    Sorry... I posted wrongly... it should be in C Programming section...
    Pls del it..... sorry.....

  3. #3
    Unregistered
    Guest
    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.

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    101
    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!!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Python mod sched question
    By Overworked_PhD in forum Tech Board
    Replies: 2
    Last Post: 04-26-2009, 04:16 PM
  2. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 10:47 PM
  3. opengl DC question
    By SAMSAM in forum Game Programming
    Replies: 6
    Last Post: 02-26-2003, 09:22 PM
  4. MOD Question from a newbie
    By BOOGIEMAN in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 12-18-2001, 09:02 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21