Ask Question
22 August, 21:40

Assume that the int variables i and j have been declared, and that n has been declared and initialized. using for loops (you may need more than one), write code that will cause a triangle of asterisks of size n to be output to the screen.

+2
Answers (1)
  1. 23 August, 00:37
    0
    You should really state what language you're using. Here it is easily produced in C#, and shouldn't be too much of a hassle to translate to other languages. Note that I did not need to use the iterative variable (j), and could instead just use (i) in one for loop.

    Console. Write ("Enter size of triangle: ");

    int n = Convert. ToInt32 (Console. ReadLine ());

    for (int i = n - 1; i > = 0; i--)

    Console. WriteLine (new String ('*', n - i));
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Assume that the int variables i and j have been declared, and that n has been declared and initialized. using for loops (you may need more ...” in 📙 Computers & Technology 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