- 2
Hello everyone, I want to solve an exercise Logical Operators in javascriptAnd I couldn't solve it, can you help me
Time 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 Resposta
0
Use a if to compare...if (hour<= 12) {
System.out.println("am");
} else {
System.out.println("pm");
}