Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main() {
- int inNumber;
- cin >> inNumber;
- if (inNumber >= 1 && inNumber <= 9) {
- for (int upperPart = 1; upperPart <= inNumber; upperPart++) {
- for (int spacing = 2; spacing <= upperPart; spacing++) {
- cout << " ";
- }
- for (int countingUpper = upperPart; countingUpper <= inNumber; countingUpper++) {
- cout << countingUpper;
- }
- cout << endl;
- }
- for (int bottomPart = 2; bottomPart <= inNumber; bottomPart++) {
- for (int spacingBottom = 1; spacingBottom < inNumber; spacingBottom++) {
- cout << " ";
- }
- int numberingDown = inNumber + 1;
- for (int countingDown = 1; countingDown <= bottomPart; countingDown++) {
- cout << --numberingDown;
- }
- if (bottomPart != inNumber) {
- cout << endl;
- }
- }
- }
- else {
- cout << -1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement