Ask Question
18 December, 22:22

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.

+1
Answers (1)
  1. 18 December, 22:48
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers