The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Please help, Having difficulty with loops
ZoSo729
post Apr 26 2007, 02:21 PM
Post #1





Group: Members
Posts: 1
Joined: 26-April 07
Member No.: 2,637



Hello,

Im trying to create a loop to display a set of asterisks to create a set of "stairs."

example:
*
**
***
****
*****
******
*******

Im not very good at html and everything Ive tried has failed.

Does anyone have any suggestions or samples?

Thanks a lot, i REALLY appreciate any help at all!
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Effovex
post Apr 26 2007, 02:34 PM
Post #2


Serious Coder
*****

Group: Members
Posts: 251
Joined: 6-January 07
From: Sherbrooke, Qc, Canada
Member No.: 1,477



You're probably looking for the PRE element......what have you tried that has failed?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Effovex
post Apr 26 2007, 04:36 PM
Post #3


Serious Coder
*****

Group: Members
Posts: 251
Joined: 6-January 07
From: Sherbrooke, Qc, Canada
Member No.: 1,477



Looks like I misread the question quite a bit. Problem is, that's not an HTML question but a Javascript or CGI/PHP question, and should be in another section.

What you're looking for is something like this (the actual details will vary depending on the language you're using) :
for(a = 1; a<=5; a++)
{
for(b = 1; b<=a; b++)
print "*";
print "<br>";
}
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
stjepan
post Apr 29 2007, 05:27 AM
Post #4


Serious Coder
*****

Group: Members
Posts: 329
Joined: 15-October 06
From: zagreb, croatia
Member No.: 445



Maybe something like this in php:
<html>
<?
for($i = 0; $i < 100; $i++) {
echo "this message has echoed $i times <br>";
}

?>
</html>

or

for($i = 0; $i < 100; $i++) {
some php code
}


User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 28th April 2024 - 07:38 AM