Saved Bookmarks
| 1. |
Where N is a positive integer (ii) To print the following triangle with N rows Example: If N = 5. Output:1514 1312 11 109 8 7 65 4 3 2 1 |
|
Answer» ong>Answer: Explanation: Given a POSITIVE INTEGER n. The problem is to print the pyramid pattern as described in the examples below. Examples: Input : n = 4 OUTPUT : 1 3*2 4*5*6 10*9*8*7 Input : n = 5 Output : 1 3*2 4*5*6 10*9*8*7 ... for ( int i=1; i<=n; i++). {. // if row number is odd. if (i%2 != 0). {. // print numbers with the '*' sign in. |
|