mirror of
https://github.com/TheAlgorithms/Java.git
synced 2026-03-13 08:40:43 +08:00
Change project structure to a Maven Java project + Refactor (#2816)
This commit is contained in:
committed by
GitHub
parent
8e533d2617
commit
9fb3364ccc
19
src/main/java/com/thealgorithms/others/FloydTriangle.java
Normal file
19
src/main/java/com/thealgorithms/others/FloydTriangle.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.thealgorithms.others;
|
||||
|
||||
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(), n = 0;
|
||||
sc.close();
|
||||
for (int i = 0; i < r; i++) {
|
||||
for (int j = 0; j <= i; j++) {
|
||||
System.out.print(++n + " ");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user