117k views
0 votes
Write a set of nested loops that display 10 rows of # characters. There should be 15 # characters in each row.

User Pendor
by
4.1k points

1 Answer

1 vote

Answer:

Following are the code to this question:

public class M//defining class M

{

public static void main(String[] as)//defining main method

{

int i,j;//defining integer variable

for (i= 1; i <=10; i++)//defining for loop for print column

{

for (j = 1; j<=15; j++)//defining for loop for print rows

{

System.out.print("#");//print # value

}

System.out.println();//print space

}

}

}

Output:

###############

###############

###############

###############

###############

###############

###############

###############

###############

###############

Step-by-step explanation:

The code defines a class "M" and the main method is defined within a class and two integer variables I and j" are defined within the primary procedure, while the next step defines two for a loop.

In the first loop, the column value is printed, and a further loop that prints the row value is declared inside the loop.

User Ilya Tchivilev
by
4.1k points