Hello everyone, I want to solve an exercise Logical Operators in javascriptAnd I couldn't solve it, can you help me
1 Answer
New AnswerTime flies when you’re having fun. Given a clock that measures 24 hours in a day, write a program that takes the hour as input. If the hour is in the range of 0 to 12, output am to the console, and output pm if it's not. Sample Input 13 Sample Output pm function main() { var hour = parseInt(readLine(), 10); // Your code goes here }
1/23/2022 1:57:16 AM
slom slomi781 Answer
New AnswerUse a if to compare...if (hour<= 12) { System.out.println("am"); } else { System.out.println("pm"); }
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message