Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int rows;
- cout << "Enter number of stars: ";
- cin >> rows;
- for(int i = 0; i < rows; i++)
- {
- for(int space = 1; space <= rows-i; space++){
- cout <<" ";
- }
- for(int j = 0; j <= i; j++)
- {
- if(j == 0){
- cout << "*" << " ";
- } else if (j == i) {
- cout << "*" << " ";
- } else if(i == rows-1){
- cout << "*" << " ";
- } else {
- cout << " ";
- }
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement