1import java.util.Scanner;
2public class PrintFloydsTriangle
3{
4 public static void main(String[] args)
5 {
6 int row, y, z, number = 1;
7 Scanner sc = new Scanner(System.in);
8 System.out.println("Enter the number of rows of floyd's triangle you want to print: ");
9 row = sc.nextInt();
10 System.out.println("Floyd's Triangle: ");
11 for(y = 1; y <= row; y++)
12 {
13 for(z = 1; z <= y; z++)
14 {
15 System.out.print(number + " ");
16 number++;
17 }
18 System.out.println();
19 }
20 sc.close();
21 }
22}