For each problem, just write the necessary code for the loops.
1. Write a loop to print out the numbers from 10 to 20, inclusive.
Print the numbers on separate lines.
2. Write a loop to print out the numbers 10 to -10, inclusive.
Print the numbers on separate lines.
3. Write a loop to add together double type numbers that the user inputs. The user will enter a negative number to terminate the calculation. Print out the resulting value.
For example, if the user types 3.2, 5.6, 2.1, 0.1, -1.0 then the printed
value should be 3.2 + 5.6 + 2.1 + 0.1 = 11.000. This is just an example
-- remember, the user could type as many positive numbers as he/she would
like.
4. Write a nested loop to print out a triangle of size n by n of *'s. An example 5 x 5 triangle is below. You may use the variable n without declaring it.
*****
****
***
**
*