Question: Can i know what the explain comment with the step 1. import java.util.Scanner; public class StarLoop1 { public static void main(String[] args) { Scanner scanner

Can i know what the explain comment with the step

1.

import java.util.Scanner;

public class StarLoop1 {

public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Please provide number of rows to print"); int myrows = scanner.nextInt(); for (int m = 1; m <= myrows; m++){ for (int n = 1; n <= m; n++){ System.out.print("*"); } System.out.println(); } } }

2.

import java.util.Scanner;

public class StarLoop2 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Please provide number of rows to print"); int myrows = scanner.nextInt(); for (int m = 0; m <= myrows; m++){ for (int n = myrows; n > m; n--){ System.out.print("*"); } System.out.println(); } } } 3.

import java.util.Scanner;

public class StarLoop3 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Please provide number of rows to print"); int myrows = scanner.nextInt(); for (int m = 1; m <= myrows; m++){ for (int n = 1; n < m; n++){ System.out.print(" "); } for (int p=myrows; p>=m; p--){ System.out.print("*"); } System.out.println(); } } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!