On Sun, 24 Aug 2003 14:01:52 +0000, Nick Li wrote:
Hi,
I am trying to print a value of a variable multiple times. For
example, the value is "*" and I want to print it five times, like
"*****". Can somebody show me a easy way to do it?
Thanks in advance.
Nick
Well, what have you tried? Do you have any ideas? You'll never learn if
you don't try.
I'll give you a hint, though. If you know how to printf a variable once,
and you know how to use a for loop, then you should be able to printf a
variable however many times you want.
Here is a simple for loop example:
#include <stdio.h>
int main(void)
{ int i;
int sum=0;
for (i=0; i<5; i++)
sum = sum+i;
printf("Sum = %d\n", sum);
return 0;
}
I Hope That Helps (HTH).
Mac
--