hello guys! wanna try a new problem๐Ÿ˜Ž๐Ÿ˜Ž,
here it goes,
here i have uploaded a small problem to solve,
now i'm uploading the solution for it using C++ language.
I have written below solution using Microsoft Visual Studio 2017 version,it may be little bit vary on ios, adios!๐Ÿ‘‹๐Ÿ‘‹

#include<iostream>
using namespace std;

void triangle(int n)
                                {
if (n == 1)
{
cout << "*"<<endl;
}

else {
triangle(n - 1);
for (int i = 0; i < n; i++)
{
cout << "*";
}
cout << endl;
}
}

int main()
{
int n;

cout << "Enter the n:";
cin >> n;

for (int i = 0; i < n; i++)
{
for (int j = n; j > i; j--)
{
cout << "*";
}
cout << endl;
}

    triangle(n);
return 0;
}










Comments

Popular Posts