Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class NumberPyramidFloydTriangle {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int number = Integer.parseInt(scanner.nextLine());
- int counter = 1;
- boolean found = false;
- for (int i = 1; i <=number; i++) {
- for (int j = 1; j<=i; j++) {
- System.out.printf("%d ",counter++);
- if (counter>number){
- found=true;
- break;
- }
- }
- if (found){
- break;
- }
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement