Sunday, April 18, 2021

44. Write a JavaScript program to check from three given integers that whether a number is greater than or equal to 20 and less than one of the others

44. Write a JavaScript program to check from three given integers that whether a number is greater than or equal to 20 and less than one of the others.

function lessby20_others(x, y, z) 
{
return (x >= 20 && (x < y || x < z)) ||
(y >= 20 && (y < x || y < z)) ||
(z >= 20 && (z < y || z < x));
}
console.log(lessby20_others(23, 45, 10));
console.log(lessby20_others(23, 23, 10));
console.log(lessby20_others(21, 66, 75));

No comments:

14 May 2021 Current Affairs