The George Washington University
School of Engineering and Applied Science
Department of Electrical Engineering and Computer Science
CSci 51 -- Spring 1999
Lab Exercise #9
For labs meeting March 11-12, 1999

1. Let n be a positive integer consisting of up to ten digits, d10d9...d1. Write a program to list in one column each of the digits in the number n. The right-most digit, d1, should be listed at the top of the column. (Hint: As computed according to the formula

digit = n REM 10

what is the value of digit if n = 3704?)

Test your program for values of n equal to 6, 3704, and 170498.

2. An integer N is divisible by 9 if the sum of its digits is divisible by 9. Use the algorithm developed for Part 1 to determine whether the following numbers are divisible by 9.

N = 154368

N = 621594

N = 123456