Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. setlocale(LC_ALL, "Russian");
  7. int n;
  8.  
  9. cout << "Введите высоту треугольника: ";
  10. cin >> n;
  11.  
  12. for (int i = 1; i <= n; i++)
  13. {
  14. for (int j = 1; j <= n * 2; j++)
  15. {
  16. if (j == ((n + 1) - (i - 1)) || j == ((n + 1) + (i - 1)))
  17. cout << '*';
  18. else
  19. if (i == n && j > 1)
  20. cout << '*';
  21. else
  22. cout << ' ';
  23. }
  24.  
  25. cout << endl;
  26. }
  27.  
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement