fork(11) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. void printStars(int num, int limit)
  5. {
  6. if (num >limit) return;
  7. else{
  8. for (int q = 1; q <= num; q++)
  9. {cout << "*";}
  10. cout << endl;
  11.  
  12. printStars(num +1, limit);
  13.  
  14. for (int q = 1; q <= num; q++)
  15. {cout << "*";}
  16.  
  17. cout << endl;
  18. }
  19.  
  20. }
  21.  
  22. int main()
  23. {
  24. int number=5;
  25. cin>>number;
  26. printStars(1, number);
  27.  
  28. return 0;
  29. } // end of main
Success #stdin #stdout 0s 3144KB
stdin
5
stdout
*
**
***
****
*****
*****
****
***
**
*