JavaAlgorithms/ft.java

19 lines
366 B
Java
Raw Normal View History

2017-06-16 19:17:35 +08:00
import java.util.Scanner;
class FloydTriangle
{
public static void main(String[] args)
{
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();
int n=0;
for(int i=0; i<r; i++)
{
for(int j=0; j<=i; j++)
{
System.out.print(++n+" ");
}
System.out.println();
}
}
}