CS 312 - Discussion Assignment
due at the beginning of class, Thursday, Oct 4


1. Write a for loop that prints all the integers from 1 to 100, one number per line.

2. Write a method that takes an integer n as its argument, and prints the integers from 1 up to n, one number per line.

3. Write a method that takes an integer m and an integer n as its arguments, and returns the sum of the integers between them.

4. Write a method that takes an integer n, and returns n! (n factorial). If n < 1, the returned value will be 1.

5. Write a Java program that reads a line of text from the user, and prints that line of text in reverse order.

6. Write a Java program that reads an integer from the user, and prints the digits, one per line, starting with the ones digit.
That is, if the integer entered by the user is 4621, the output would be:
1
2
6
4

7. Write a Java program that reads a string from the user, and prints every other character, starting with the first. If the user enters: hello world, then the output should be:
hlowrd