First question:
X3 * 6528 = 3X * 8256
X fills in a number for a number to make the equation set
for (x=1;x<10;x++) {
var a= (x*10+3);
var b= (3*10+x);
if (a*6528==b*8256) {
alert (x);
}
}
The second question:
On the page, output the shape
*
***
*****
*******
*********
var x = 1;
for (Var i=4;i>=0;i--) {
for (var sp = 1;sp<=i;sp++) {
document.write (" ");
}
for (var st = 1;st<=x;st++) {
document.write ("*");
}
x+=2;
document.write ("<br>");
}
Question three:
Find out all the "daffodils" between 100-999. The so-called Narcissus number refers to a three-digit number, the cubic of the numbers and equal to the number itself. (such as 15 of the 3-time Square =1 of 3 square +5 3 times Square +3) and output these numbers
for (x=1;x<10;x++) {
for (y=1;y<10;y++) {
for (z=1;z<10;z++) {
M=x*x*x+y*y*y+z*z*z;
N=100*x+10*y+z;
if (m==n) {
document.write (n+ "<br>");
}
}
}
}
Question Fourth:
Output all leap years from 1000 to now
for (var sb = $; SB <=; sb++) {
if (sb% 100 = 0) {
if (sb% 4 = = 0 && SB% 100! = 0) {
document.write (SB + "<br>");
}
} else {
If (sb% 400 = = 0) {
document.write (SB + "<br>");
}
}
}
Question Fifth:
Write programs, calculate 1!+2!+3!+.....+10! The result.
var x=0;
for (i=1;i<11;i++) {
var a=1;
for (b=1;b<=i;b++) {
A*=b;
}
X+=a;
}
alert (x);
About the practice of using the For loop to solve practical problems in JS