C++ All patterns
*
***
****
*****#include <iostream>
using namespace std;
int main()
{
int num = 5;
for(int i=1; i<=5; i++)
{
for(int j=1; j<=i; j++)
{
cout << "* ";
}
cout << "\n";
}
return 0;
}*****
****
***
**
*#include <iostream>
using namespace std;
int main()
{
int num = 5;
for(int i=1; i<=5; i++)
{
for(int j=5; j>=i; j--)
{
cout << "* ";
}
cout << "\n";
}
return 0;
} *
**
***
****
*****#include <iostream>
using namespace std;
int main()
{
int num = 5;
for(int i=1; i<=5; i++)
{
for(int j=i; j<5;j++)
{
cout << " ";
}
for(int k=1; k<=i; k++)
{
cout << "*";
}
cout << "\n";
}
return 0;
} *****
****
***
**
*#include <iostream>
using namespace std;
int main()
{
int num = 5;
for(int i=1; i<=5; i++)
{
for(int j=1; j<i;j++)
{
cout << " ";
}
for(int k=i; k<=5; k++)
{
cout << "*";
}
cout << "\n";
}
return 0;
} *
* *
* * *
* * * *
* * * * * #include <iostream>
using namespace std;
int main()
{
int num = 5;
for(int i=1; i<=5; i++)
{
for(int j=i; j<5;j++)
{
cout << " ";
}
for(int k=1; k<=i; k++)
{
cout << "* ";
}
cout << "\n";
}
return 0;
} *
* * *
* * * * *#include <iostream>
using namespace std;
int main()
{
int num;
cout << "Enter Number: ";
cin >> num;
for(int i=1; i<=num; i++)
{
for(int j=i; j<num; j++)
{
cout << " ";
}
for(int k=1; k<=2*i-1; k++)
{
cout <<"* ";
}
cout <<"\n";
}
return 0;
}0
0
0