Java program to print floyd’s triangle

Previous
Next

In this post, we will see how to print Floyd’s triangle in java.

Problem

You need to print Floyd’s triangle as below for n=5.

Floyd’s triangle
****************
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15

Floyd’s triangle in java

Let’s create class “FloydTriangleMainExample.java” as below

When you run above program, you will get below output:

Enter the number of rows for floyd’s triangle:
6
Floyd’s triangle
****************
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21

That’s all about printing floyd’s cycle in java.

Previous
Next

Join Our News Letter – Stay Updated

Subscribe to Awesome Java Content.




Add Comment

Join Our News Letter - Stay Updated

Subscribe to Awesome Java Content.
You can like our facebook page Java2blog