Loop problem

Hello everyone. Can you please help me on this certain problem?

A mathematician named Ulam proposed generating a sequence of numbers
from any positive integer number as follows:
If n is 1, stop
If n is even, replace it with n / 2

If n is odd, replace it with 3 * n + 1

Write a program to generate Ulam sequence of positive
integers. Include an option to repeat the process.
Sample Run:


Enter a positive integer 6

3 10 5 16 8 4 2 1
Try Again [Y/N]?


Thank you very much.
Last edited on
So what part is it that you have problem with?
Oh, I mean, can you please make a source code for this. I am only a beginner and I really do not have any idea on loop problems. Thank you.
Sorry, we don't do homeworks.
Topic archived. No new replies allowed.