C++ Program To display the half pyramid of *, numbers and character. C++ Program to print half pyramid as using * as shown in figure below.C++ Programs To Create Pyramid and Pattern. Examples to print half pyramid, pyramid, inverted pyramid, Pascal's Triangle and Floyd's triangle in C++ Program to Print Triangle of Stars - In C++ language you can print any triangle of stars patter, here you need nested loop first loop for print star and inner
#include <iostream>
using namespace std;
int main()
{
int choice;
cout << "how much lines you need\n";
cin >> choice;
for (int a = 0; a < choice; a++)
{
for (int b = 0; b <= a; b++)
{
cout <<"*";
}
cout << endl;
}
system("pause");
}
Code 2 :-
#include <iostream>
using namespace std;
int main()
{
int z=0;
int choice;
cout << "how much lines you need\n";
cin >> choice;
for (int a = 0; a < choice; a++)
{
for (int b = 0; b <= a; b++)
{
z++;
cout << " " << z << " ";
}
cout << endl;
}
system("pause");
}
Sign up here with your email
ConversionConversion EmoticonEmoticon