22 lines
730 B
JavaScript
22 lines
730 B
JavaScript
|
let number1 = parseFloat(prompt("Add meg az első számot:"))
|
||
|
let number2 = parseFloat(prompt("Add meg a második számot:"))
|
||
|
|
||
|
if (!isNaN(number1) && !isNaN(number2)) {
|
||
|
console.log((number1 + number2).toFixed(2));
|
||
|
console.log((number1 - number2).toFixed(2));
|
||
|
console.log((number1 * number2).toFixed(2));
|
||
|
if (number2 == 0) {
|
||
|
console.log("Nem lehet nullával osztani!");
|
||
|
} else {
|
||
|
console.log((number1 / number2).toFixed(2));
|
||
|
}
|
||
|
|
||
|
if (number2 == 0) {
|
||
|
console.log("Nem lehet nullával osztani!");
|
||
|
} else {
|
||
|
console.log((number1 % number2).toFixed(2));
|
||
|
}
|
||
|
console.log(((number1 + number2) ** 2).toFixed(2));
|
||
|
} else {
|
||
|
console.log("Érvénytelen bemeneti adat!");
|
||
|
}
|