Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>6</title>
- </head>
- <body>
- <script>
- var eq1, eq2, eq3, eq4;
- //alert("This program will process 2 numbers using addition, subtraction, multiplication or division.");
- // var n1 =parsefloat(prompt("enter the first number"));
- var n2 =parsefloat(prompt("enter the second number"));
- var eqn = prompt("choose one operation from the following list: \nA โ Addition \nS โ Subtraction\nM โ Multiplication\nD - Division");
- if (eqn = "A" )
- {
- eq1 = n1 + n2;
- alert(n1 + " + "+n2+" = "+eq1);
- }
- else if (eqn = "S" )
- {
- eq2 = n1 - n2;
- alert(n1 + " - "+n2+" = "+eq2);
- }
- else if (eqn = "M" )
- {
- eq3 = n1 * n2;
- alert(n1 + " * "+n2+" = "+eq3);
- }
- else if (eqn = "D" )
- {
- eq4 = n1 / n2;
- alert(n1 + " รท "+n2+" = "+eq4);
- }
- else
- {
- alert(" please try again, remember when selscting a computation method to print the shortend variable as shown (A,S,M or D) ");
- }
- </script>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement