#include
using namespace std;
int main(){
int n;
cin>>n;
int col=1;
while(col<=n){
int row=1;
while(row<=col ){
cout<<row<<’\t’;
row++;
}
cout<<endl;
col++;
}
return 0;
}
#include
using namespace std;
int main(){
int n;
cin>>n;
int col=1;
while(col<=n){
int row=1;
while(row<=col ){
cout<<row<<’\t’;
row++;
}
cout<<endl;
col++;
}
return 0;
}
@safwanjaved5742_779f5468729e3535 just like you are increasing the row variable for the first half, decrease it for thr right half
can you edit my code
try doing it on your own first, decrease it till row reaches 1
I tried but not able to solve
not getting desired output
fixed the numbrs, now you have to print some spaces in between, i commented where to add that code https://ide.codingblocks.com/s/596684
not getting output as per question
@safwanjaved5742_779f5468729e3535 number of spaces are also dependent on the line number, basically instead of numbers you have to replace them with spaces
I am not getting what u r saying instead u edit the code
@safwanjaved5742_779f5468729e3535 see the sample output and count the number of tabs in each line and try to find a pattern there
edit the code as per output i am not getting
@safwanjaved5742_779f5468729e3535 please try to find the logic on your own. I see that you are struggling with these pattern questions so it wont benefit you if i write the code for you. I’ll try my best to assist you in developing the logic.
Count the number of spaces in each line (spaces in between the inc and dec sequence). and write them in the reply below.