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.

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Menghsiu Lee Python 6 07-23-2012 09:19 PM Nik Coughlin HTML 40 12-24-2008 07:58 PM reynArd VHDL 0 11-20-2004 08:44 AM reynArd Cisco 0 11-20-2004 08:35 AM