Advertisement
biswasrohit20

bronzesilver for cal

Mar 13th, 2021
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. // bronze
  2.  
  3. while(true){
  4.  
  5. var c = prompt("Calculate Program \n1. Add numbers \n2. Subtract numbers \n3. Multiply numbers \n4. Divide numbers \nWhat's your choice ?")
  6.  
  7. var num1 = parseInt(prompt("Enter the first number "))
  8.  
  9. var num2 = parseInt(prompt("Enter the second number "))
  10. if (c == 1) {
  11. console.log(num1 + num2)
  12. } else if (c == 2) {
  13. console.log(num1 - num2)
  14. } else if (c == 3) {
  15. console.log(num1 * num2)
  16. } else if (c == 4) {
  17. console.log(num1 / num2)
  18. }
  19.  
  20. var conti = prompt("If you want to enter another calculation press 'y'")
  21. if(conti != 'y'){
  22. break
  23. }
  24. }
  25.  
  26.  
  27.  
  28.  
  29.  
  30. // silver
  31.  
  32.  
  33. while(true){
  34.  
  35. var c = prompt("Calculate Program \n1. Add numbers \n2. Subtract numbers \n3. Multiply numbers \n4. Divide numbers \nWhat's your choice ?")
  36.  
  37. var num1 = parseInt(prompt("Enter the first number "))
  38.  
  39. var num2 = parseInt(prompt("Enter the second number "))
  40. if (c == 1) {
  41. console.log(num1 + num2)
  42. } else if (c == 2) {
  43. console.log(num1 - num2)
  44. } else if (c == 3) {
  45. console.log(num1 * num2)
  46. } else if (c == 4) {
  47. console.log(num1 / num2)
  48. }
  49.  
  50. var conti = prompt("If you want to enter another calculation press 'y'")
  51. if(conti != 'y' && conti != 'Y'){
  52. break
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement