Printing Patterns using for loops
- From: "priyam.trivedi@xxxxxxxxx" <priyam.trivedi@xxxxxxxxx>
- Date: 28 Feb 2006 07:23:20 -0800
I saw this in one article but I cannot understand why the coder has
used z--. I did it without z-- and it still works the same.
Please help.
Priyam
Trying to print the following pattern but...
$$$$$
$$$$5
$$$55
$$555
$5555
The Code
----------
void PrintPatternThree (int PatternSize)
{
int Row = 0;
int Col = 0;
int Temp = 0; // used to hold the new value of PatternSize for
evaluating
Temp = PatternSize;
for (Row = 1; Row <= PatternSize; Row++)
{
for (Col = 1; Col <=PatternSize; Col++)
{
if (Row <= Col)
printf ( "$" );
else
printf ( "%d", PatternSize);
} // end Col
Temp--;
printf ( "\n" );
} // end Row
return;
} /* end PrintPatternFour()
$$$$$
$$$$5
$$$55
$$555
$5555 */
.
- Follow-Ups:
- Re: Printing Patterns using for loops
- From: Vladimir S. Oka
- Re: Printing Patterns using for loops
- Prev by Date: Re: Help in c pointers
- Next by Date: Re: need help getting the results of the system function into a variable
- Previous by thread: stdint.h and portability
- Next by thread: Re: Printing Patterns using for loops
- Index(es):