programming-examples/js/Conditional/Write a JavaScript program that accept two integers and display the larger..js
2019-11-15 12:59:38 +01:00

17 lines
583 B
JavaScript

var num1, num2;
num1 = window.prompt("Input the First integer", "0");
num2 = window.prompt("Input the second integer", "0");
if(parseInt(num1, 10) > parseInt(num2, 10))
{
console.log("The larger of "+ num1+ " and "+ num2+ " is "+ num1+ ".");
}
else
if(parseInt(num2, 10) > parseInt(num1, 10))
{
console.log("The larger of "+ num1+" and "+ num2+ " is "+ num2+ ".");
}
else
{
console.log("The values "+ num1+ " and "+num2+ " are equal.");
}