i need help to make this pattern 1 222 33333 4444444 555555555 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

i need help to make this pattern 1 222 33333 4444444 555555555

5th Sep 2016, 6:38 PM
Mayan Pahwa
Mayan Pahwa - avatar
10 Answers
0
i got close to your answer but i couldn't really get tht output
5th Sep 2016, 7:43 PM
Leslie Jason
Leslie Jason - avatar
0
thanks anyway
5th Sep 2016, 7:45 PM
Mayan Pahwa
Mayan Pahwa - avatar
0
#include <iostream> using namespace std; int main() { for(int i=1; i<=5; i=i+2) { for(int j=1; j<=i; j++) { cout<< i; } cout<< endl; } return 0; } with this the out put is 1 333 55555
5th Sep 2016, 7:49 PM
Mayan Pahwa
Mayan Pahwa - avatar
0
can anyone help me with this 1234567 234567 34567 4567 567 67 7
5th Sep 2016, 7:56 PM
rehan altaf
rehan altaf - avatar
0
int i, j; for (i = 1; i <= 5; i++) { for (j = 1; j <= i*2-1; j++) { cout << i; } cout << endl; }
5th Sep 2016, 11:16 PM
Zen
Zen - avatar
0
thanks zen
6th Sep 2016, 3:02 AM
Mayan Pahwa
Mayan Pahwa - avatar
0
for (i = 1, j = 1; i < 4; i++, j += 2){ for (k = 0; k < j; k++) cout<<i; cout<<endl; } Use this part of the code you will get it... All the best :)
12th Feb 2019, 11:34 AM
Simply All in One
Simply All in One - avatar
0
shubham kumar stop spaming QnA with link to your last code: you've still polluting about 50 threads... please kindly delete these posts ^^
21st Jul 2020, 1:23 AM
visph
visph - avatar
0
for c it will be like this #include<stdio.h> int main() { int i,j,k; for(int i=1,j=1;i<=9;i++,j+=2) { for(k=0;k<j;k++) { printf("%d",i); } printf("\n"); } return 0; }
2nd Jun 2022, 6:04 AM
nishant
- 1
#include <iostream> using namespace std; int main() { for(int i=1; i>=5; i++) { for(int j=1; j<=i; j++) { cout<< i; } cout<< endl; } return 0; }
5th Sep 2016, 7:42 PM
Leslie Jason
Leslie Jason - avatar