Ask Question
26 September, 23:09

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.

+4
Answers (1)
  1. 27 September, 01:41
    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 you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers