hey guys how would i print something 60 times without actually typing the character out 60 times.

printf("#"*60);

^ which is complete rubbish and doesnt work, but what is the syntax for it?

cheers!

Recommended Answers

All 6 Replies

hello dost

U can print a characher many itme by using a for loop or using while loop
i.e.
for(i=0;i<60;i++)
printf("#");

for(i=0;i<60;i++)
printf("#");

U can print a character by using control statements like for loop and also by while loop.:)

for(i=0;i<60;i++)
printf("#");
commented: The first post was enough. -1

hey
i.e.
int i=1;
while (i<=60)
{
printf("#");
i++;
}
or
do
{
printf("#");
i++;
}while(i<60)

hey
i.e.
int i=1;
while (i<=60)
{
printf("#");
i++;
}
or
do
{
printf("#");
i++;
}while(i<60)

Posted source code must be wrapped between proper tags that will display it in a consistent format and familiar neatness.
Example shown here

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.