Assignment8
Problem 1
Write a program to print the numbers 1 to 10 and their squares. Try to match the output.
1 1
2 4
3 9
...
10 100
Problem 2
Add to this program output that tells if each number is odd or even. Make it so the user can tell the program how many numbers to print.
1 1 odd
2 4 even
3 9 odd
...
10 100 even
Problem 3
Write a program to print the following triangle.
*
**
***
****
*****
******
*******
********
*********
**********
Hint: Don't use ten printf statements; use two nested loops instead.
Problem 4
Write a program to simulate rolling N dice with M sides. Save the sum of the N dice to an array. Output the histogram of the results.