You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
write a code that accepts an input of integer type, which represents the number of rows to display the Floyds Triangle pattern upto 6 rows. Display “invalid rows” without a pattern if the input given is negative:
3
+
4
+
1
5
+
2 3
6
+
4 5 6
7
+
7 8 9 10
8
+
11 12 13 14 15
9
+
16 17 18 19 20 21
10
+
11
+
Input Format
12
+
13
+
The input should be taken as row number.
14
+
15
+
Constraints
16
+
17
+
row number should be positive>0
18
+
19
+
Output Format
20
+
21
+
It should print “Invalid rows” if the input taken is zero 0r less than zero.
22
+
23
+
Sample Input 0
24
+
25
+
4
26
+
Sample Output 0
27
+
28
+
1
29
+
2 3
30
+
4 5 6
31
+
7 8 9 10
32
+
*/
33
+
importjava.io.*;
34
+
importjava.util.*;
35
+
36
+
publicclassSolution {
37
+
38
+
publicstaticvoidmain(String[] args) {
39
+
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
0 commit comments