- 2
Print Pyramid, half pyramid, inverted pyramid
Assignment in school
1 Antwort
+ 7
intuyous
Try to code yourself using this hint..since it is your assignment
1>>>take user input for number of lines you need in pyramid..
2>>>you should use for loop upto the range of your input...if you are printing asterisks pyramid one for loop is enough.. this for loop denotes rows of your pyramid..if you need to print number pyramid two for loops needed..
Let for asterisks pyramid ,
3>>>the print statement should contain (number of lines - no. Of rows) multiplied by asterisk
For number pyramid..
You should use two for loops..
Outer for loop ranges upto your input
Inner for loop range should be
(no. of lines - no.of rows)
Then use print statement to print appropriate pattern