Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class time
- {
- public static void main(String args[])
- {
- Scanner s = new Scanner(System.in);
- System.out.println("Enter Time in hours : ");
- int time = s.nextInt();
- if(time < 12 && time > 0)
- {
- System.out.println("Good Morning" );
- }
- else if( time < 18 && time >= 12)
- {
- System.out.println("Good Afternoon" );
- }
- else if( time < 24 && time >= 18)
- {
- System.out.println("Good Night" );
- }
- else{
- System.out.println("ERROR");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment