Ask Question

Write code that causes a "triangle" of asterisks of size n to be output to the screen. specifically, n lines should be printed out, the first consisting of a single asterisk, the second consisting of two asterisks, the third consisting of three, etc. the last line should consist of n asterisks. thus, for example, if n has value 3, the output of your code should be

+2
Answers (1)
  1. 3 May, 19:51
    0
    Like this

    #include void pa (int n) { if (! n) { printf ("/n"); return; }printf ("*"); pa (n-1); }void lines (int n) {if (! n) return; lines (n-1); pa (n); }int main (void) {lines (5); return 0; }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write code that causes a "triangle" of asterisks of size n to be output to the screen. specifically, n lines should be printed out, the ...” in 📗 Computers & Technology 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