当前位置:网站首页>Circular exercises of JS
Circular exercises of JS
2022-06-25 12:38:00 【Fall in love with*】
1. Enter the score five times in a cycle , Sum up averaging For maximum For the minimum .
2. List 1-1000 All odd and even numbers within
3. Chicken and rabbit in the same cage : in total 100 A foot , How many each ?
4. The output is reversed 99 Multiplication table
5. Output the number of daffodils in all three digits .( Narcissistic number : The third power of a bit + The third power of ten + The third power of a hundred == The number itself )
Such as :153 = 1*1*1 + 5*5*5 + 3*3*36. Cycle through a student 5 And calculate the average score , If a score is entered as negative , Stop entry and prompt for entry errors
7. There is an equation 12()34()56()78()9 = 59, Only add and subtract can be placed in brackets , If you want the equation to hold , So what symbols should be placed in each bracket .
var sum = 0;
var avg = 0;
var max = 0;
var min;
var score = 0;
for (var i = 1; i <= 5; i++) {
score = Number(prompt(" Please enter the first " + i + " Second grade "));
sum += score;
avg = sum / 5;
max = max > score ? max : score;
min = min < score ? min : score;
}
document.write("sum=" + sum + "<br/>");
document.write("avg=" + avg + "<br/>");
document.write("max=" + max + "<br/>");
document.write("min=" + min + "<br/>");
for (var i = 1; i <= 1000; i++) {
if (i % 2 == 0) {
document.write(i + "<br/>");
}
}
for (var i = 1; i <= 1000; i++) {
if (i % 2 != 0) {
document.write(i + "<br/>");
}
}
for (var i = 1; i <= 50; i++) {
for (var j = 1; j <= 25; j++) {
if (2 * i + 4 * j == 100) {
document.write(" The number of chickens " + i + "_______________" + " The number of rabbits is " + j
+ "<br/>");
}
}
}
for (var i = 9; i >= 1; i--) {
for (var j = 1; j <= i; j++) {
document.write("<span>" + j + "*" + i + "=" + (j * i) + "</span>");
}
document.write("<br/>");
}
span{
width: 75px;
display: inline-block;
}
body {
width: 2000px;
}// stay style Set in
for (var i = 100; i < 1000; i++) {
var bai = parseInt(i / 100);
var shi = parseInt(i / 10 % 10);
var ge = parseInt(i % 10);
if (i == ge * ge * ge + shi * shi * shi + bai * bai * bai) {
document.write("1000 The number of daffodils within is " + i + "<br/>");
}
}
var avg = 0;
var sum = 0;
var score = 0;
for (var i = 1; i <= 5; i++) {
score = Number(prompt(" Please enter the first " + i + " Results of courses "));
if (score < 0) {
alert(" Stop typing , Input error ");
break;
}
sum += score;
}
avg = sum / 5;
document.write(" The average is divided into " + avg + "<br/>");
// There is an equation 12()34()56()78()9 = 59, Only add and subtract can be placed in brackets , If you want the equation to hold , So what symbols should be placed in each bracket .
// With positive and negative 1 Instead of the plus and minus signs
for (var a = -1; a < 2; a += 2) {
for (var b = -1; b < 2; b += 2) {
for (var c = -1; c < 2; c += 2) {
for (var d = -1; d < 2; d += 2) {
if (12 + a * 34 + b * 56 + c * 78 + d * 9 == 59) {
document.write(a + "<br/>" + b + "<br/>" + c + "<br/>" + d + "<br/>");
}
}
}
}
}
边栏推荐
- Digital currency exchange -- digital currency exchange system development source code sharing
- Set the transparency of the picture to gradient from left to right
- Total number of MySQL statistics, used and unused
- Pycaret successfully resolved the problem that 'sklearn model_ selection._ Search 'import name "\u check\u param\u grid"
- JQ dynamic setting radio does not take effect when selected
- Micro engine generates QR code
- Shell learning notes (latest update: 2022-02-18)
- Zhangxiaobai's road of penetration (VI) -- the idea and process of SQL injection and the concat series functions and information of SQL_ Schema database explanation
- Array reorder based on a field
- When MySQL queries fields in JSON format, it takes a property value of JSON data
猜你喜欢
Guess Tongyuan B
Total number of MySQL statistics, used and unused
Laravel excel export
Windows下MySQL的安装和删除
Navicat premium view password scheme
GPS receiver design (1)
(4) Pyqt5 tutorial -- > Custom signal and slot (super winding...)
为何数据库也云原生了?
Shell learning notes (latest update: 2022-02-18)
(3) Pyqt5 tutorial -- > signal and slot preliminary test
随机推荐
visual studio2019链接opencv
揭秘GaussDB(for Redis):全面對比Codis
PHP multidimensional array sorting
Go defer little knowledge
ThinkPHP upload image compression size
Development with courtesy -- share the source code of the secondary development of the app system of the imitation shopping mall
Laravel multi project mutual access
Arm V7 LDR STR memory access
Mind mapping video
SDN system method | 9 Access network
Figure explanation of fiborache sequence
Controllable character image synthesis based on attribute decomposition and Gan reproduction
Why do we do autocorrelation analysis? Explain application scenarios and specific operations
Laravel echart statistical chart line chart
Gradle knowledge points
Ten commandments of self-learning in machine learning
Zunpin Yongyao advertising e-commerce system -- Zunpin Yongyao advertising e-commerce app system development source code sharing
Penetration tool environment - installing sqli labs in centos7 environment
Set the transparency of the picture to gradient from left to right
JQ dynamic setting radio does not take effect when selected