<!doctype html>
<html>
<head>
<meat charset="utf-8">
<title>javascript循环</title>
</head>
<body>
<script type="text/javascript">
/*1~100之间奇数和*/
var sum=0;
for (var i=1;1<=100;i++){if(i%2==1){sum+=1;}}
document.write(‘1~100之间奇数的和为:‘+sum+‘<hr/>‘);
/*九九乘法表*/
document.write(‘<hr color="red"/>‘);
document.write(‘<table border=‘1‘ cellsapcing=‘0‘ cellpadding=‘0‘ bgcolor=‘#dddddd‘>‘)
for(var i=1;i<=9;i++){
document.write(‘<tr>‘);
for(var j=1;j<=i;j++){document.write(‘<td> ‘+i+‘x‘+j+‘=‘+(i*j)‘</td>‘);}
document.write(‘</tr>‘);}
document.write(‘</table>‘)
document.write(<hr/>)
/*百鸡买百钱 三for*/
for(var i=0;i<=20;i++){
for(var j=0;j<=33;j++){
for(var z=0;z<=100;z++){
if(x+y+z=100&&5*x+3*y+z/3=100){
document.write(‘公鸡:‘+i+‘只 ‘+‘母鸡:‘+j+‘只 ‘+‘小鸡:‘+z+‘只 ‘);}
}}}
/*百鸡买百钱 二for*/
for(var i=0;i<=20;i++){
for(var j=0;j<=33;j++){
z=100-i-j;
if(z%3=0&&5*x+3*y+z/3=100){
document.write(‘公鸡:‘+i+‘只 ‘+‘母鸡:‘+j+‘只 ‘+‘小鸡:‘+z+‘只 ‘);}
}}
</script>
</body>
</html>