WAP in C++ to print the pattern | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

WAP in C++ to print the pattern

1 23 456 and the pattern 1 12 123 1234

10th Jun 2017, 10:36 AM
Sanjeev Kumar
Sanjeev Kumar - avatar
2 Answers
+ 8
Treating this like a practice once in a while. int i = 1; for (int j = 1; j <= 3; j++, cout << "\n") { for (int k = 0; k < j; k++) cout << i++; } //and for (int i = 1; i <= 4; i++) { for (int j = 1; j <= i; j++) { cout << j; } cout << endl; }
10th Jun 2017, 2:10 PM
Hatsy Rei
Hatsy Rei - avatar
- 1
can u please explain the working ??
10th Jun 2017, 5:20 PM
Sanjeev Kumar
Sanjeev Kumar - avatar