Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   multiplying step by step (http://www.go4expert.com/forums/multiplying-step-step-t25828/)

 Martin0027 18May2011 22:25

multiplying step by step

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.

 xpi0t0s 19May2011 13:15

Re: multiplying step by step

You could use the modulo operator:
Code:

```int x=125 % 10; int y=(125/10) % 10;```
results in x containing 5 and y 2.

 Chong 19May2011 13:49

Re: multiplying step by step

Hi

Best regards
Chong

 Chong 19May2011 13:52

Re: multiplying step by step

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

 Martin0027 19May2011 16:36

Re: multiplying step by step

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?

 All times are GMT +5.5. The time now is 00:17.