Need help on following program using c language Write a recu
Need help on following program using c++ language.
Write a recursive function that takes as a parameter a nonnegative integer and generates the following pattern of stars. If the nonnegative integer is 4, then the pattern generated is:
Also, write a program that prompts the user to enter the number of lines in the pattern and uses the recursive function to generate the pattern. For example, specifying 4 as the number of lines generates the above pattern.
Solution
#include <iostream>
using namespace std;
void Stars(int num,int i)
 {
 if (i == num)
 {
 return;
 }
 for (int j = num ;j > i; j--)
 {
 cout << \"*\";
 }
 cout << endl;
Stars(num,i+1);
 for (int j = num; j > i; j--)
 {
 cout << \"*\";
 }
 cout << endl;
 }
int main()
 {
 cout<<\"Enter number \"<<endl;
 int n;
 cin>>n;
Stars(n+1,1);
 return 0;
 }
===========================================================
Comment about the work

