-
about printf
How do I print from right to left using printf? Do I need a specific escape sequence? For example I need to print
************
***** *****
**** ****
*** ***
** **
* *
but when I run my program I get
************
***** *****
**** ****
*** ***
** **
* *
Any suggestions would be appreciated.
-
Sorry, the picture didnt turn out like I expected.
-
>Sorry, the picture didnt turn out like I expected.
Edit it and use [code][/code] tags to preserve spacing. And post your code as well.
-
I saw what you ment by hovering the mouse on the topic in the forum.
I don't think you can write from right to left. however , you could figure an algorithm that knows how many spaces there are between the two shapes.
It simply goes like this :
- output 6 and 6 asterisks on the first line.
- output 5 asterisks , a space and another 5 asterisks.
- output 4 asterisks , two spaces and another 4 asterisks
and so on...
hope this helps
-
> Any suggestions would be appreciated.
Posting your code would help
-
ok my program is:
Code:
for (i=1; i>1; i--)
{
for (j=1, J<=i, J++)
printf("*");
for(k=i; k<n; k++)
printf(" ");
for (j=1; j<=i; j++)
printf("*");
I just have a nested for loop, and it is the last for loop which needs to be changed. Im just stuck.
-
And for those still not paying attention - an interlude
<pointless music>
http://cboard.cprogramming.com/showthread.php?t=25765
</pointless music>
Your thread will resume once you've read that and edited your post accordingly.
-
-
LOL!
Now, if we can find a good "use code tags" theme music, we can add it to all the posts :D
> for (i=1; i>1; i--)
Well you could post the code which produced your results, because this code isn't it.
This loop never runs, it immediately fails the first test ( 1 is not > 1 )
-
Perhaps you could tell us what n is?