floyd 27s triangle star pattern in java

Solutions on MaxInterview for floyd 27s triangle star pattern in java by the best coders in the world

showing results for - "floyd 27s triangle star pattern in java"
Emily
08 Nov 2017
1// Floyd's triangle star pattern in java
2import java.util.Scanner;
3public class FloydTriangleStars
4{
5   public static void main(String[] args) 
6   {
7      Scanner sc = new Scanner(System.in);
8      System.out.println("Enter the number of rows of floyd's triangle you want to print: ");
9      int rows = sc.nextInt();
10      System.out.println("Printing floyd's triangle with stars in java");
11      for(int a = 1; a <= rows; a++)
12      {
13         for(int b = 1; b <= a; b++)
14         {
15            System.out.print("* ");
16         }
17         System.out.println();
18      }
19      sc.close();
20   }
21}