Clean up FloydTriangle (ft.java)

This commit is contained in:
KylerSmith 2017-07-07 18:24:45 -07:00
parent da55838a8e
commit 1af3806a88
2 changed files with 15 additions and 17 deletions

BIN
.DS_Store vendored

Binary file not shown.

32
ft.java
View File

@ -1,19 +1,17 @@
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();
}
}
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(), n = 0;
for(int i=0; i < r; i++) {
for(int j=0; j <= i; j++) {
System.out.print(++n + " ");
}
System.out.println();
}
}
}