#include "stdafx.h" #include <iostream> using namespace std; int main() { int a, length; printf("Enter length: "); cin >> length; a = length / 2; for (int b = 1; b <= a; b++) { for (int c = 1; c <= b; c++) { cout << c; } cout << endl; } for (int e = a-1; e >= 1; e--) { for (int d = 1; d <= e; d++) { cout << d; } cout << endl; } cin.get(); cin.get(); }
Output