Re: My problem in C
So, I have these four outputs which I need to have:
Pattern 6:
1 2 3 4 5
1 2 3 4 -
1 2 3 - -
1 2 - - -
1 - - - -
Pattern 7:
1 ----
1 2 ---
1 2 3 --
1 2 3 4 -
1 2 3 4 5
Pattern 8:
1 2 3 4 5
- 1 2 3 4
- - 1 2 3
- - - 1 2
- - - - 1
Pattern 9:
1 2 3 4 5 5 4 3 2 1
1 2 3 4 - - 4 3 2 1
1 2 3 - - - - 3 2 1
1 2 - - - - - - 2 1
1 - - - - - - - - 1
I did solved the first one like this, (Pattern 6):
for(i=1;i<=5;i++)
{
for(j=1;j<=n-i+1;j++)
{
printf("%d",j);
}
for(j=1;j<i;j++)
{
printf("-");
}
printf("\n");
}
But how can I solve the remaining three?
Note: the outer loop, while it is stated i<=5, but in actuality, it is supposed to be i<=n. sorry if you get confused by that.
-- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector