There are four figures which you have to make the program print out. I have successfully completed the first two. The last two require spaces to be entered to make the shape. The shape is:
**********
*********
********
*******
******
*****
****
***
**
*
Its basically that.. just as you can imagine, its 90 degrees straight up on the RIGHT side of it ( couldn't get the real shape to come out on this haha ). The other one is that except shape (with 90 degrees on the right side ) flipped upside down.
My code for the first shape is ( code for the second shape is almost the same ):
Quote
#include <stdio.h>
int main (void)
{
int x, y;
for ( x=1; x<11; x++ )
{
for ( y=1; y<=x; y++ )
{
printf( "*" );
}
printf( "\n" );
}
return 0;
}
int main (void)
{
int x, y;
for ( x=1; x<11; x++ )
{
for ( y=1; y<=x; y++ )
{
printf( "*" );
}
printf( "\n" );
}
return 0;
}
My problem is, I don't know how to get the spaces in there to make the shape. I've tried almost everything I know how to do. Any help is appretiated!
This post has been edited by shanebp: 17 October 2007 - 07:24 AM

New Topic/Question
Reply




MultiQuote




|