- Write a loop to sum the integers from 1 to 100
- Write a loop to sum the even numbers from 1 to 50.
- Write a loop to sum the odd numbers from 1 to 50.
- 3n+1 conjecture. Read in a positive integer from the keyboard and repeatedly apply the following rule: If the number is odd, multiply by 3 and add 1 If the number is even, divide by 2 Repeat until the number 1 is reached. For example n = 5 5 16 8 4 2 1 n = 30 15 46 23 40 20 10 5 16 8 4 2 1
- Write a loop to compute the floating point sum from 1/1 + 1/2 + ... + 1/n, for n=100
Compute the same sum backwards. Print out the difference between the two sums and determine which one is more accurate.
- Mystery Sum: Compute the sum:
$1/1^2 + 1/2^2 + 1/3^2 + ... 1/n^2$ .
- Read in a positive integer from the keyboard and print out an n by n multiplication table
- Read in a positive integer n and find the longest 3n+1 conjecture for every number from 1 up to n.