Table of Contents
show
Example 26
Write the equivalent code for the following using for loop
var count=new Array();
i=0;
do
{
if(i%2 == 0)
count[i]=1;
else
count[i]= i *10;
i=i+1;
}while(i<=5)
console.log(count);
Output
Example 27
Find the output
var sum, a;
sum = 0;
a = 1;
do
{
sum = sum + a;
a = a+2;
}while(a<=8)
console.log(sum);
Output
Views: 52