daily pastebin goal
46%
SHARE
TWEET

Untitled

a guest Dec 10th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void trojkat(int n);
  6. int j = 1;
  7. int i = 0;
  8.  
  9. int main()
  10. {
  11.     int n; 
  12.     cout << "Podaj liczbe gwiazdek w podstawie: ";
  13.     cin >> n;
  14.     trojkat(n);
  15. }
  16.  
  17. void trojkat(int n)
  18. {
  19.     if(j <= n)
  20.     {
  21.         if(i < j)
  22.         {
  23.             cout << "*";
  24.             i++;
  25.             trojkat(n);
  26.         }
  27.         else if(i == j)
  28.         {
  29.             i=0;
  30.             ++j;
  31.             cout << "" << endl;
  32.             trojkat(n);
  33.         }
  34.     }
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top