2019-05-09 19:32:54 +08:00
|
|
|
package Others;
|
|
|
|
|
2017-06-16 19:17:35 +08:00
|
|
|
import java.util.Scanner;
|
2017-07-08 09:24:45 +08:00
|
|
|
|
2017-11-06 02:17:19 +08:00
|
|
|
|
|
|
|
class FloydTriangle {
|
2017-07-08 09:24:45 +08:00
|
|
|
public static void main(String[] args) {
|
2019-05-09 19:32:54 +08:00
|
|
|
Scanner sc = new Scanner(System.in);
|
|
|
|
System.out.println("Enter the number of rows which you want in your Floyd Triangle: ");
|
|
|
|
int r = sc.nextInt(), n = 0;
|
|
|
|
sc.close();
|
|
|
|
for (int i = 0; i < r; i++) {
|
|
|
|
for (int j = 0; j <= i; j++) {
|
|
|
|
System.out.print(++n + " ");
|
|
|
|
}
|
|
|
|
System.out.println();
|
|
|
|
}
|
|
|
|
}
|
2017-06-16 19:17:35 +08:00
|
|
|
}
|