C Data Structure Write Recursive Function Draws Following Figure N 4 Q37143719

c++, data structure

Write a recursive function that draws the following figure for n= 4

****

***

**

*

**

***

****


Solution


#include <iostream>using namespace std;void print_line(int n) { if (n > 0) { cout << “*”; print_line(n-1); } else { cout << endl; }}void print_pattern(int n) { if (n == 1) { print_line(n); } else {

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.