Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(int argc, char const *argv[]) {
- // Number 1
- int rows, cols, val = 9;
- rows = val;
- while (rows >= 1) {
- cols = 1;
- while (cols <= rows) {
- cout << rows;
- cols++;
- }
- cout << endl;
- rows--;
- }
- // Number 2
- rows = 0; cols = 0;
- do {
- cols = 1;
- do {
- cout << rows;
- cols++;
- } while (cols <= rows);
- rows++;
- cout << endl;
- } while (rows <= val);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement