Posts

Showing posts with the label floyd's triangle program in java

Floyd's triangle and reverse Floyd's triangle in java

Image
Hello friends, Let's see what is Floyd's triangle! The concept of Floyd's Triangle  was invented by the computer scientist Robert Floyd. Floyd's Triangle is a right angled triangle filled by natural numbers, which is having n rows. In this triangle nth row will have n natural numbers. So in the first row there will  be only 1 element, that is, 1, in the second row there will be 2 elements next to one, 2 and 3, in third row there will be 3 elements 4,5 and 6. In this way the triangle so formed is called Floyd's Triangle. 1 2 3 4 5 6 7 8 9 10 This is the Floyd's Triangle having 4 rows. Reverse Floyd's Triangle:- Now let us see what is Reverse Floyd's Triangle. It is simply reverse of Floyd's Triangle. The natural numbers are written from end to start. For example, the Reverse Floyd's Triangle for 4 rows will be: 10 9 8 7 6 5 4 3 2 1 This is the Reverse Floyd's Triangle having 4 rows. Here's a program to print Floyd...