Tag: Remove prompt password to determine positive integer size even pass error
One, enter three numbers, determine the size
var one = prompt ("Please enter the first number"); var two = prompt ("Please enter second number"); var three = prompt ("Please enter a third number"); var big = one > both? One > three? One:three:two > three? Two:three;alert (big);
Within two or 100, all numbers and
var he = 0; for (var shu = 1;shu <= 100;shu++) { = he + Shu;} alert (he);
Within three or 100 of the number related to 7
var shuchu = "; for (var seven = 7;seven <= 100;seven = seven + 10) {sh Uchu = Shuchu + "." + Seven;} for (var seven = 7;seven <= 100;seven = seven + 7 = Shuchu + "." + Seven;} for (var seven = 70;seven <= 79;seven++) {Shuchu
= Shuchu + "." + Seven;} alert (Shuchu);
Iv. Suppose a simple ATM's withdrawal process is like this:
The user is prompted to enter the password (password) First,
You can enter up to three times, more than 3 times to prompt the user "password error,
Please collect the card "to close the transaction. If the user's password is correct,
Then prompt the user to enter the withdrawal amount (amount),
ATM machine can only output 100 yuan of banknotes, one time to take the minimum amount required
100 yuan, up to 1000 yuan.
If the amount entered by the user meets the above requirements, the print output user obtains the money,
Finally prompt the user "The transaction completes, please collect the card", otherwise prompts the user to reenter the amount.
Assuming that the user password is 111111, please program the implementation.
varPassword = prompt ("Please enter password"); for(varCishu = 0;cishu <=2;cishu++) { if(Password = = 123){ varAmount = Prompt ("Please enter withdrawal amount"); while(Amount < | | Amount >1000 | | (Amount% 100! = 0) ) {Amount= Prompt ("The amount is wrong, please re-enter the withdrawal amount"); } alert ("You have removed the" +amount+ "element"); Alert ("Transaction completed, please collect card"); Break;}Else if(Cishu = = 2) {alert ("Password input error three times, please pick up the card"); } Else{Password= Prompt ("Password is wrong, please re-enter password"); }}
All even numbers within five or 100
var str = ""; for (var shu = 0;shu <=; shu++) { if(shu%2 = = 0) { = str + "," + Shu;
}}alert (str);
Input positive integer n, for 1 to N and
var n = prompt ("Please enter a positive integer"); var b = 0; for (var a = 0;a <= n;a++) { = b + A;} Alert (b)
0511JS Process Exercise