You are on page 1of 3

Anwser 2:

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.");
}

Answer 7:

var GFG = (function () {

function GFG() {

GFG.print24 = function (str) {

var h1 = (str.charAt(1)).charCodeAt(0) - '0'.charCodeAt(0);

var h2 = (str.charAt(0)).charCodeAt(0) - '0'.charCodeAt(0);

var hh = (h2 * 10 + h1 % 10);

if ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(str.charAt(8)) ==


'A'.charCodeAt(0)) {

if (hh === 12) {

console.info("00");

for (var i = 2; i <= 7; i++) {


console.info(str.charAt(i));

else {

for (var i = 0; i <= 7; i++) {

console.info(str.charAt(i));

else {

if (hh === 12) {

console.info("12");

for (var i = 2; i <= 7; i++) {

console.info(str.charAt(i));

else {

hh = hh + 12;

console.info(hh);

for (var i = 2; i <= 7; i++) {

console.info(str.charAt(i));

};
GFG.main = function (args) {

var str = "07:05:45PM";

GFG.print24(str);

};

return GFG;

}());

GFG["__class"] = "GFG";

GFG.main(null);

You might also like