Thursday, June 5, 2008

Print 100 asterisks one at time with 10th multiple

/*Write a program that prints 100 aesterisks ,one at a time.After every tenth aesterisk,your program should print a newline character
Hint:count from 1 to 100.Use the modulus operator to recognize each time the counter reaches a multiple of 10
*/

**********
**********
**********
**********
**********
**********
**********
**********
**********
**********


Soln.Code :-
========


#include

int main(void)
{
int i;
for ( i = 1 ; i <= 100 ; i++)
{
printf("%c",42);
if ( i % 10 == 0 )
printf("\n");
}
}

No comments: