P.S. I'm a beginner and I was trying to find the following output :
1
1 2 3
1 2 3 4 5
1 2 3 4 5 6 7
1 2 3 4 5
1 2 3
1
and here's my try :
#include<stdio.h>
#include<conio.h>
void main() {
int n;
scanf("%d",&n);
for(int i=1;(i<=2*n);i++){
int temp=1,t=2*n-1;
for(int j=0;j<abs(n-i);j++){
printf(" ");
}
for(int j=t;j>=abs((2*(i-1))-t);j--) {
printf(" %d",temp);
temp++;
}
printf("\n");
}
}
as you can see.. I tried my best to remove the i=n condition UNSUCCESSFULLY. or if anyone can provide a more easier way to print the pattern.. I'd my grateful