Given an int variable n that has already been declared and initialized to a positive value, and another int variable j that has already been declared, use a for loop to print a single line consisting of n asterisks. Thus if n contains 5, five asterisks will be printed. Use no variables other than n and j.

Respuesta :

Answer:

for(j = n; j > 0; j--)

System.out.print(\"*\");

Step-by-step explanation:

-A for loop is a repetition control structure.

-It allows the efficiency to write a loop that would otherwise be written a couple of times.

-The output is a single line comprising n asterisks,

-The number of asterisks printed will be equivalent to the n-value declared.

Answer:

for(j = 0; j < n; j++) {

cout << "*";

}

Step-by-step explanation:

For C++ Version