Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int height = 5;
- int i, j;
- for(i = 1; i <= height; i++) {
- if (i == height) {
- for (j = 1; j <= (height+1); j++) {
- if (j != 6) {
- cout << " ";
- }
- else {
- cout << "*";
- }
- }
- }
- else {
- for(j = 1; j <= (height + i); j++) {
- if(j <= (height - i + 1))
- cout << ' ';
- else
- cout << '*';
- }
- cout << '\n';
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement