English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

(Assume that all HTML tags are in place)



1. What is the output?
2. How would you modify this code so that it prints only even numbers?
(Rewrite the program)
3. How would you modify the code so that it sums all the values of i and prints the final sum?

2007-04-04 01:12:43 · 4 answers · asked by Tazzzy 1 in Computers & Internet Programming & Design

4 answers

1)
0123456789

2)

or


3)

2007-04-04 02:21:19 · answer #1 · answered by AnalProgrammer 7 · 0 0

Your obviously doing some kind of homewrok here!

1. Your output would be .... 0 1 2 3 4 5 6 7 8 9

2. ...
for(i=0; i<10, i+2)
...

3.

2007-04-04 08:38:33 · answer #2 · answered by tom4annak 2 · 0 0

Ans:
qns 1:
123456789

qns2:
for(i=0;i<10;i++)
{
if((i/2)==0){
document.write(i);
}
}

qns3:
for(i=0;i<10;i++)
{
var total=0;
total=total+i;
}
document.write(total);

2007-04-04 08:39:33 · answer #3 · answered by fang 4 · 0 0

var j=0;
for (i=0; i<10; i++;) { if (!(i%2)) document.write(i);
j+=i; }
document.write(j);

2007-04-04 11:56:37 · answer #4 · answered by fjpoblam 7 · 0 0

fedest.com, questions and answers