Simple Number Pattern

Simple Number Pattern

1280 720 mrrohit

To print any patterns of numbers or stars (*) in Java Programming, you have to use two loops.

The first is an outer loop and the second is an inner loop.

The outer loop is responsible for rows and the inner loop is responsible for columns

outer for loop
 
// outer for loop
for(int i=0; i<5; i++)    
         {
//inner for loop will be write here
}

 

 

Simple Number Pattern
 
public class StarAndNumber {
      public static void main(String[] args) {
            // TODO Auto-generated method stub
            for(int i=0; i<5; i++)
            {
                  int count = 1;
                  
                  for(int j=0; j<=i; j++)
                  {
                        System.out.print(count);
                        count++;
                  }
                  System.out.println();
            }
      }
}
Press Ctrl+C to copy the following code.
"