Advertisement
Guest User

Untitled

a guest
Nov 18th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main() {
  4.     int time;
  5.     char name[25];
  6.  
  7.     printf("What is your name?\n");
  8.     scanf("%s", name);
  9.     printf("What is the time?\n");
  10.     scanf("%d", &time);
  11.  
  12.     time >= 0 && time <= 2400 ?
  13.         time >= 400 && time <= 2300 ?
  14.         printf("Good %s, %s!\n", time <= 1200 ? "Morning" : (time <= 1600 ? "Afternoon" : "Evening"), name)
  15.         :
  16.         puts("What are you doing up?\n")
  17.     :
  18.     puts("Wrong time input!\n");
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement