0
WAP in C++ to print the pattern
1 23 456 and the pattern 1 12 123 1234
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;
}
- 1
can u please explain the working ??