Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var numb1 = parseInt(prompt('Введите 1-е число',''));
- function isNumeric(numb1) {
- return !isNaN(parseFloat(numb1)) && isFinite(numb1);
- }
- if (oper === '+') {
- var numb2 = parseInt(prompt('Введите 2-е число','')); // Объявление переменной желательно один раз запилить
- var result = numb1 + numb2; // same shit
- alert('Сумма равна: ' + result);
- } else if(oper === '-'){
- var numb2 = parseInt(prompt('Введите 2-е число',''));
- var result = numb1 - numb2;
- alert('Разница равна: ' + result);
- } else if(oper === '*'){
- var numb2 = parseInt(prompt('Введите 2-е число',''));
- var result = numb1 * numb2;
- alert('Произведение равно: ' + result);
- } else if(oper === '/'){
- var numb2 = parseInt(prompt('Введите 2-е число',''));
- var result = numb1 / numb2;
- alert('Отношение равно: ' + result);
- } else if(oper === '%'){
- var numb2 = parseInt(prompt('Введите 2-е число',''));
- var result = numb1 % numb2;
- alert('Остаток от деления: ' + result);
- } else {
- alert('Неверная операция');
- }
Advertisement
Add Comment
Please, Sign In to add comment