June 16th, 2013, 09:36 PM

seperate digits
(Separating Digits) Write program segments that accomplish each of the following:
a) Calculate the integer part of the quotient when integer a is divided by integer b.
b) Calculate the integer remainder when integer a is divided by integer b.
c) Use the program pieces developed in a) and b) to write a function that inputs an integer
between 1 and 32767 and prints it as a series of digits,with two spaces between each digit.
For example, the integer 4562 should be printed as:
:
4 5 6 2
actually mind blown at the part says sperate digits
Last edited by mx8manger; June 16th, 2013 at 11:57 PM.
Reason: previous topic was lame
June 17th, 2013, 01:36 AM

Originally Posted by mx8manger
(Separating Digits) Write program segments that accomplish each of the following:
a) Calculate the integer part of the quotient when integer a is divided by integer b.
b) Calculate the integer remainder when integer a is divided by integer b.
c) Use the program pieces developed in a) and b) to write a function that inputs an integer
between 1 and 32767 and prints it as a series of digits,with two spaces between each digit.
For example, the integer 4562 should be printed as:
:
4 5 6 2
actually mind blown at the part says sperate digits
You have all the necessary information in the question to build your program. Not sure if you understood the math. Here's a reiteration using an example:
Round 1:
int division: 4562 / 10 = 456 # This is step a.
int modulo operation: 4562 % 10 = 2 # This is step b.
Round 2:
int division: 456 / 10 = 45
int modulo operation: 456 % 10 = 6
Round 3:
int division: 45 / 10 = 4
int modulo operation: 45 % 10 = 5
Round 4:
int division: 4 / 10 = 0
int modulo operation: 4 % 10 = 4
In every round, after the modulo operation, you have the last digit in that rounds' number. It's up to you to use a suitable logic to print them as desired.
Try it out and let us know where you're stuck.