floyd triangle

This commit is contained in:
Ashish Agarwal 2017-06-16 16:47:35 +05:30
parent 7b0ffb16d6
commit d89189a5d1
2 changed files with 19 additions and 0 deletions

BIN
.DS_Store vendored

Binary file not shown.

19
ft.java Normal file
View 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();
}
}
}