import java.util.Scanner;
      public class Main
      {
          public static void main(String[] args) 
          {
             //initialize the variable 
             int i,j,n,k=1;
             //taking user input for number of row.
             System.out.print("Enter number of row ");
             Scanner sc=new Scanner(System.in);
             n=sc.nextInt();
             //declare outer loop for every new row
             for(i=1;i<=n;i++)
             {
                  //declare inner loop for print number in row.
                  for(j=1;j<=i;j++)
                  {
                       System.out.print(k+" ");
                       //increment k because we need to print incremented value 
                       k++;
                  }
                  System.out.println(); 
              }
           }
      }
      
      Java language logo

      Program for Floyd’s Trianlge

      0

      0

      avatar
      drzyadav

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.