Loops/For: Difference between revisions

From Rosetta Code
Content added Content deleted
(New page: {{task}}Specifically print out the following pattern by using one for loop nested in another: <pre>* ** *** **** *****</pre> =={{header|C}}== for(i = 1; i <= 5; i++) { for(j = 1; j <= i; ...)
 
No edit summary
Line 7: Line 7:


=={{header|C}}==
=={{header|C}}==
for(i = 1; i <= 5; i++) { for(j = 1; j <= i; j++) putchar('*'); puts(""); }
<pre language="C">for(i = 1; i <= 5; i++) { for(j = 1; j <= i; j++) putchar('*'); puts(""); }</pre>

Revision as of 14:04, 11 April 2008

Task
Loops/For
You are encouraged to solve this task according to the task description, using any language you may know.

Specifically print out the following pattern by using one for loop nested in another:

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

C

for(i = 1; i <= 5; i++) { for(j = 1; j <= i; j++) putchar('*'); puts(""); }