Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "iostream"
- using namespace std;
- using namespace System;
- int main() {
- Random r;
- int n = r.Next(2, 10);
- for (int i = 1; i <= n; i++) {
- for (int j = n; j >= 1; j--)
- {
- if (j + i - 1 >= n) {
- cout << j << " ";
- }
- else {
- cout << " ";
- }
- }
- for (int j = 2; j <= n; j++)
- {
- if (j + i - 1 >= n) {
- cout << j << " ";
- }
- else {
- cout << " ";
- }
- }
- cout << endl;
- }
- for (int i = 2; i <= n; i++) {
- for (int j = n; j >= 1; j--)
- {
- if (j >= i) {
- cout << j << " ";
- }
- else {
- cout << " ";
- }
- }
- for (int j = 2; j <= n; j++)
- {
- if (j >= i) {
- cout << j << " ";
- }
- else {
- cout << " ";
- }
- }
- cout << endl;
- }
- system("pause>NULL");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement