Thursday , September 21 2017
Home / Blue J / Java program for Floyds Triangle

Java program for Floyds Triangle

Java program for Floyds Triangle:

Floyd’s Triangle is one of the most popular pattern in programming lanuguage. It is not usually famous by its name as it is very easy in implementation. The diagram below shows you the floyds triangle:

Floyds triangle

// Java program for Floyd's triangle
import java.util.*;
class floyd
	public static void main(String args[])
	int i,j,n,k=1;
	Scanner sc=new Scanner(;
	System.out.print("Enter the size of floyd's triangle: NUMBER OF ROWS : ");
		for(j=1;j<=i;j++)   // since in first line you will display on 1 number in second line only two numbers so on ..
		System.out.print(k++ + "\t");  // Using /t will help in proper spacing , but ' ' will not give proper spacing
	System.out.println();        //  Changing line after every jth loop; 


Java program for floyd's triangle
Java program for Floyd’s triangle

Check Also

Program to check Upper Triangular matrix

What is Upper Triangular Matrix?  An upper triangular matrix is a square matrix in which ...

Leave a Reply

Your email address will not be published. Required fields are marked *