Velocity Reviews > Can someone teach me? Thx!!!

# Can someone teach me? Thx!!!

tianyi
Guest
Posts: n/a

 11-09-2004
I'm the beginner of C programming. And my teacher give a question I don't
know how to do. Can someone teach me? Thx!!

The Question is: To print out four *,and skip one line. The print out
like: ****

****

****

****

If someone can help me?

Jason Whitehurst
Guest
Posts: n/a

 11-09-2004
tianyi wrote:
> I'm the beginner of C programming. And my teacher give a question I
> don't know how to do. Can someone teach me? Thx!!

Have you tried? Show us what you came up with...

--
Jason Whitehurst

tianyi
Guest
Posts: n/a

 11-09-2004
for (i=1; i<=5; i++)
{
for(j=1; j<=i; j++)
{
for(K=1; k<=4; k++)
printf ("*");
printf("\n");
}
printf("\n");
}

tianyi
Guest
Posts: n/a

 11-09-2004
for (i=1; i<=5; i++)
{
for(j=1; j<=i; j++)
{
for(K=1; k<=4; k++)
printf ("*");
printf("\n");
}
printf("\n");
}

E. Robert Tisdale
Guest
Posts: n/a

 11-09-2004
tianyi wrote:

> for (i=1; i<=5; i++)
> {
> for(j=1; j<=i; j++)
> {
> for(K=1; k<=4; k++)
> printf ("*");
> printf("\n");
> }
> printf("\n");
> }
>

Great!
Did you try to compile it?

Mike Wahler
Guest
Posts: n/a

 11-09-2004

"tianyi" <(E-Mail Removed)> wrote in message
> I'm the beginner of C programming. And my teacher give a question I don't
> know how to do. Can someone teach me? Thx!!
>
> The Question is: To print out four *,and skip one line. The print out
> like: ****
>
> ****
>
> ****
>
> ****
>
>
> If someone can help me?

#include <stdio.h>

int main()
{
int i = 0;

putchar('*'); /* print a single asterisk */

putchar('\n'); /* print out a 'newline' character */
/* i.e. a blank line.

printf("\n\n"); /* print two blank lines */

for(i = 0; i < 10; ++i) /* print ten asterisks */
putchar('*');

printf("%s\n", "***"); /* print three astersiks followed */
/* by a 'newline' character */
return 0;
}

The above should be enough information for you to figure
out how to do your assignment.

-Mike

tianyi
Guest
Posts: n/a

 11-09-2004
thx all you guys' help.

i'm now know how to correct it.

thanks again.