Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void pattern(int stars, int spaces)
- {
- if(stars == 0)
- return;
- pattern(stars/2, spaces);
- for(int i = 0; i < spaces; i++)
- {
- cout << " ";
- }
- for(int i = 0; i < stars; i++)
- {
- cout << "*";
- }
- cout << endl;
- pattern(stars/2, spaces+stars/2);
- }
- int main()
- {
- pattern(8, 0);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement