JAVA PROGRAM FOR FLOYD'S TRIANGLE MODEL-II

import java.io.*;
import java.util.*;

public class floyds{

public static void main(String arg[])
{

int i,j,s=1;

Scanner sc=new Scanner(System.in);
System.out.println("Enter the limit");

int n=sc.nextInt();

System.out.println();

for(i=1;i<=n;i++)
{

for(j=1;j<=i;j++)
{
   System.out.print(s+"\t");
 
}

System.out.println();
 s=s+1;
}

}
}

SAMPLE OUTPUT:


No comments:

Post a Comment