floyd triangle
This commit is contained in:
parent
7b0ffb16d6
commit
d89189a5d1
19
ft.java
Normal file
19
ft.java
Normal file
@ -0,0 +1,19 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user