#include "stdafx.h" #include <iostream> using namespace std; int main() { int n; cout << "Enter number: "; cin >> n; for (int i = 1; n>0; n--, i++) { for (int j = 1; j<n; j++) cout << " "; for (int j = 1; j<i; j++) cout << "0"; cout << i % 10; for (int j = 1; j<i; j++) cout << "0"; cout << "\n"; } cout << "\npress any key to exit..."; getchar(); getchar(); }
Output