Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int tam = 1;
  4. void tamgiac(int a)
  5. {
  6.     for (int count = 1; count <= a; count++)
  7.     {
  8.         for(int dem = 1; dem <= count; dem++) {
  9.             cout << "*";
  10.             cout << " ";
  11.         }
  12.         cout << endl;
  13.     }
  14. }
  15. void tamgiacnguoc(int a)
  16. {
  17.     for (int count = a; count >=1; count--)
  18.     {
  19.         for(int dem = count; dem >=1; dem--) {
  20.             cout << "*";
  21.             cout << " ";
  22.         }
  23.         cout << endl;
  24.     }
  25. }
  26. void inmanhinh(int a)
  27. {
  28.     for (int count = 1; count <= a; count++)
  29.     {
  30.         tam = 1;
  31.         for(int dem = 1; dem <= count; dem++) {
  32.             cout << tam;
  33.             cout << " ";
  34.             tam += 2;
  35.         }
  36.         cout << endl;
  37.     }
  38. }
  39. int main()
  40. {
  41.  
  42.     tamgiacnguoc(10);
  43.     inmanhinh(10);
  44.     tamgiac(10);
  45.     system("pause");
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement