Write Recursive Function Draws Following Figure N 4 Note Need Help Write Problem C Using V Q37142417

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

****

***

**

*

**

***

****

Note: I need help to write out this problem in C++ whileusing Visual Studio 2017


Solution


#include<iostream>#include<string.h>using namespace std;void print(int n){ if(n>0){ cout<<“*”; print(n-1); }}void printPattern(int n, int i, bool flag){ if(i == n+1){ return; } else{ print(i); cout<<endl; if(i == 1)

OR
OR

Leave a Comment

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