Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions