+ 1
i need help to make this pattern 1 222 33333 4444444 555555555
10 Antworten
0
i got close to your answer but i couldn't really get tht output
0
thanks anyway
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
0
can anyone help me with this
1234567
234567
34567
4567
567
67
7
0
int i, j;
for (i = 1; i <= 5; i++) {
for (j = 1; j <= i*2-1; j++) {
cout << i;
}
cout << endl;
}
0
thanks zen
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 :)
0
shubham kumar stop spaming QnA with link to your last code: you've still polluting about 50 threads... please kindly delete these posts ^^
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;
}
- 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;
}