Car Insurance Quotes - Debt Consolidation - Golf Store - ID badge templates - Debt Consolidation

PDA

View Full Version : loop?... how..


Namuk
Mar 14th 2008, 1:41 am
i'm very beginner on this programing....

anyone can help me to do this loop problem...
how to right code to get the result below

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

please help and teach me.....
thanks....

nico_swd
Mar 14th 2008, 1:49 am
Looks like your homework to me. So no copy and paste code for you, but this:

http://www.w3schools.com/js/js_loop_for.asp

Namuk
Mar 14th 2008, 2:07 am
Looks like your homework to me. So no copy and paste code for you, but this:

http://www.w3schools.com/js/js_loop_for.asp

:D thanks... that is what i need.... thanks for help.....:D

coolcode007
Mar 18th 2008, 12:51 am
as NicoSwd says dont Copy and paste for homework, but here is the code :)


<script type="text/javascript">
var i=0;
var j=0;
for (i=0;i<=4;i++)
{
for (j=0;j<=i;j++){
document.write("*");
}
document.write("<br />");
}
</script>

Namuk
Mar 18th 2008, 2:23 am
as NicoSwd says dont Copy and paste for homework, but here is the code :)


<script type="text/javascript">
var i=0;
var j=0;
for (i=0;i<=4;i++)
{
for (j=0;j<=i;j++){
document.write("*");
}
document.write("<br />");
}
</script>

thanks a lot..... hehehehe:):):)

Namuk
Mar 18th 2008, 5:13 am
*........*
**......**
***....***
****..****
**********


how to doing loop result like this?...
"." is nothing just a space....

coolcode007
Mar 20th 2008, 10:58 pm
hey NamUk i have replied to your email message though DP few days back with the code, not sure you got it

&nbsp is used to make a space


<script type="text/javascript">
var i=0;
var j=0;
for (i=0;i<=4;i++)
{
for (j=0;j<=i;j++){
document.write("*");
}

for (j=0;j<=((4-i)*4)-2;j++){
document.write("&nbsp;");
}

for (j=0;j<=i;j++){
document.write("*");
}

document.write("<br />");
}

</script>

Namuk
Mar 22nd 2008, 8:03 am
hey NamUk i have replied to your email message though DP few days back with the code, not sure you got it

&nbsp is used to make a space


<script type="text/javascript">
var i=0;
var j=0;
for (i=0;i<=4;i++)
{
for (j=0;j<=i;j++){
document.write("*");
}

for (j=0;j<=((4-i)*4)-2;j++){
document.write("&nbsp;");
}

for (j=0;j<=i;j++){
document.write("*");
}

document.write("<br />");
}

</script>


i got it already.... thanks....