Programmers Choice
Pages
Home
Java
Sunday, August 7, 2011
write a loop that adds the numbers 1 to 100 and prints the result
Write a loop that adds the numbers 1 to 100 and prints the result?
1 comment:
Gaurav Matta
August 7, 2011 at 11:19 AM
function print100()
{
var sum=0;
for(i=1;i<=100;i++)
{
sum=sum+i;
}
document.write(sum);
}
print100();
Reply
Delete
Replies
Reply
Add comment
Load more...
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
function print100()
ReplyDelete{
var sum=0;
for(i=1;i<=100;i++)
{
sum=sum+i;
}
document.write(sum);
}
print100();