G2A Many GEOs
SHARE
TWEET

Pyramid of numbers

JOHNYTHEWINNER Feb 16th, 2020 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # include <iostream>
  2. using namespace std;
  3. #include <iomanip>
  4. #include <math.h>
  5. #include <cmath>
  6. #include <string>
  7.  
  8. int main()
  9. {
  10.     int number;
  11.     cin >> number;
  12.     bool isbigger = false;
  13.     int current = 1;
  14.     for (int rows = 1; rows <= number; rows++) {
  15.         for (int numbers = 1; numbers <= rows; numbers++) {
  16.             if (current > number) {
  17.                 isbigger = true;
  18.                 break;
  19.             }
  20.             cout << current << " ";
  21.             current++;
  22.         }
  23.         if (isbigger) {
  24.             break;
  25.         }
  26.         cout << endl;
  27.     }
  28.     return 0;
  29. }
RAW Paste Data
Ledger Nano X - The secure hardware wallet
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top