Q:

Java Program to print stars using for loop

0

Java Program to print stars using for loop

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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

public class ForLoop {
  public static void main(String[] args) {
    int row, numberOfStars;
 
    for (row = 1; row <= 10; row++) {
      for(numberOfStars = 1; numberOfStars <= row; numberOfStars++) {
        System.out.print("*");
      }
      System.out.println(); 
    }
  }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now