Input sequence of integers (zero to stop): -4 3 -20 10 45 100 -1 0 The sum of positive numbers is: 158Hint: while would be a good construct to use. Consider a single number in each iteration. In the while-expression check if this number is not zero. If not -- proceed, if yes -- stop evaluation and print out the result. Declare a variable where your program will collect the sum of positive numbers. Make sure to initialize this variable. In the loop, with an if, check if the number is positive and, if yes, add it to the sum.
Input number: 4 **** **** **** **** * ** *** **** * ** *** ****Note that your program has to work for an arbitrary integer, not just 4. You can use either while or for looping constructs. You are not allowed to use functions, arrays or other constructs that we have not studied.
Hint: For each figure, you need to use two nested loops: the outer loop will iterate over rows (of stars) and the inner loop will print out the the stars in a single row. The programming structure for all figures is similar. I suggest you code and debug the first figure printout and then proceed to the next. For the second figure, the number of stars printed in the inner loop is the same as the row number. That is, the loop variable of the outer loop should be present in the loop-expression in the inner loop. The third figure code is similar to the first two: the total number of characters is the same in each row. However at some point, the type of character changes from space to star.