Ask Question
28 January, 14:12

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.

+3
Answers (1)
  1. 28 January, 15:04
    0
    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.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Given an int variable n that has already been declared and initialized to a positive value, and another int variable j that has already ...” in 📙 Mathematics if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers