Exercise 1 15 points Write a program that print out the firs

Exercise 1 (15 points)

Write a program that print out the first N lines of following pattern:

#

##

###

####

#####

……

The first line includes 1 pound sign;

The second line includes 2 pound signs;

The third line includes 3 pound signs;

……

Exercise 2 (15 points)

Ask a user to input a positive integer number and calculate the sum of the digits.

For example: number = 245, the sum of the digits = 2 + 4 + 5 = 11

Solution

exercise 1

2)

Exercise 1 (15 points) Write a program that print out the first N lines of following pattern: # ## ### #### ##### …… The first line includes 1 pound sign; The s

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site