Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include <string>
- using namespace std;
- int main(){
- int size = 20; //Change this
- char s = '*'; //Change this
- int e = 2;
- for (int i = 0; i < size; i++){
- if ((i + 1) % 2 == 1){ //If "i" is odd
- //Prints blank spaces
- printf("%*c", size - i - e, ' ');
- for (int h = 0; h < i + 1; h++){
- //Prints stars to form the pyramid
- printf("%c", s);
- }
- cout << endl;
- e--;
- }
- }
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement