Guest User

Untitled

a guest
Nov 17th, 2015
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var numb1 = parseInt(prompt('Введите 1-е число',''));
  2. function isNumeric(numb1) {
  3.   return !isNaN(parseFloat(numb1)) && isFinite(numb1);
  4. }
  5.    
  6. if (oper === '+') {
  7.     var numb2 = parseInt(prompt('Введите 2-е число','')); // Объявление переменной желательно один раз запилить
  8.     var result = numb1 + numb2; // same shit
  9.     alert('Сумма равна: ' + result);
  10. } else if(oper === '-'){
  11.     var numb2 = parseInt(prompt('Введите 2-е число',''));
  12.     var result = numb1 - numb2;
  13.     alert('Разница равна: ' + result);
  14. } else if(oper === '*'){
  15.     var numb2 = parseInt(prompt('Введите 2-е число',''));
  16.     var result = numb1 * numb2;
  17.     alert('Произведение равно: ' + result);
  18. } else if(oper === '/'){
  19.     var numb2 = parseInt(prompt('Введите 2-е число',''));
  20.     var result = numb1 / numb2;
  21.     alert('Отношение равно: ' + result);
  22. } else if(oper === '%'){
  23.     var numb2 = parseInt(prompt('Введите 2-е число',''));
  24.     var result = numb1 % numb2;
  25.     alert('Остаток от деления: ' + result);
  26. } else {
  27.     alert('Неверная операция');
  28. }
Advertisement
Add Comment
Please, Sign In to add comment