If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Need Help!

I need to know how to code the following problems.. I am stuck
1) A positive integer is classified as being deficient, perfect, or abundant - depending on
whether the sum of the divisors of N is less than, equal to, or greater than N. In summing the
divisors, 1 is included, but N itself is not. For example, the divisors of 4 are 1 and 2; since 1
+ 2 =3, is a deficient number. The divisors of 6 are 1,2, and 3; since 1+2+3 = 6, 6 is a
perfect number. The divisors of 12 are 1, 2, 3, 4, and 6; since 1+2+3+4+6=16,12 is an
abundant number. Write a program that accepts a positive integer as input, and reports its
classification.

2) Mathematicians study a class of problems known as random walk problems. The following
is an example. The suspended foot bridge over the Epsilon River is 20 steps across and 8
steps wide. After having spent too many hours drinking at a nearby pub, a person walking
home must cross this bridge. Each time this person takes a step forward across this wobbly
bridge he also takes a step to one side or the other. The probability of a step to the left is
exactly equal to the probability of a step to the right. This person steps on to the bridge
exactly on the centre line, but if he should travel to the left or right more than 4 steps, he
will fall off. Simulate the bridge crossing 100 times to find out what percentage of the time
the person will successfully make it to the other side without falling off.