multiplying step by step

Discussion in 'C' started by Martin0027, May 18, 2011.

  1. Martin0027

    Martin0027 New Member

    Joined:
    May 12, 2011
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Hi, I need advice on how to multiply and store numbers in the box that way: 125 * 125 split to 125 * 5 (put in field1) 125 * 2 ​​* 10 (put in field2) 125 * 1 * 100 (put in field3) and then all added together and printed on a desktop.
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    You could use the modulo operator:
    Code:
    int x=125 % 10;
    int y=(125/10) % 10;
    
    results in x containing 5 and y 2.
     
  3. Chong

    Chong New Member

    Joined:
    May 15, 2011
    Messages:
    29
    Likes Received:
    7
    Trophy Points:
    0
    Hi
    What is your question? Is it your discovery or you mean to ask something?

    Best regards
    Chong
     
  4. Chong

    Chong New Member

    Joined:
    May 15, 2011
    Messages:
    29
    Likes Received:
    7
    Trophy Points:
    0
    Hi
    I am sorry that you were giving a solution. I am new to this webiste and leraning how to use this website.
    Best regards
    Chong
     
  5. Martin0027

    Martin0027 New Member

    Joined:
    May 12, 2011
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    but how do I resolve read from the command line, I do not know how I enter the digits
    it would need to take that number from the back %10, erase the last digit and %10 again to get all the numbers what they are?
    could it be? or which functions i should use?
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice