Advertisement
pcsiasop

tth

Jun 1st, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #include "iostream"
  2.  
  3. using namespace std;
  4. using namespace System;
  5.  
  6. int main() {
  7.  
  8. Random r;
  9. int n = r.Next(2, 10);
  10. for (int i = 1; i <= n; i++) {
  11. for (int j = n; j >= 1; j--)
  12. {
  13. if (j + i - 1 >= n) {
  14. cout << j << " ";
  15. }
  16. else {
  17. cout << " ";
  18. }
  19.  
  20. }
  21. for (int j = 2; j <= n; j++)
  22. {
  23. if (j + i - 1 >= n) {
  24. cout << j << " ";
  25. }
  26. else {
  27. cout << " ";
  28. }
  29. }
  30.  
  31. cout << endl;
  32.  
  33. }
  34. for (int i = 2; i <= n; i++) {
  35. for (int j = n; j >= 1; j--)
  36. {
  37. if (j >= i) {
  38. cout << j << " ";
  39. }
  40. else {
  41. cout << " ";
  42. }
  43.  
  44. }
  45. for (int j = 2; j <= n; j++)
  46. {
  47. if (j >= i) {
  48. cout << j << " ";
  49. }
  50. else {
  51. cout << " ";
  52. }
  53. }
  54.  
  55. cout << endl;
  56.  
  57. }
  58. system("pause>NULL");
  59. return 0;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement