-->
Showing posts with label display different message. Show all posts
Showing posts with label display different message. Show all posts

Write a program to read time in hours and displays different message

//Write a program to read time in hours and displays following message.
//       0 to 12                                                        Good morning
//        12 to 18                                                     Good evening
//        18 to 24                                                     Good night
#include<stdio.h>
#include<conio.h>
void main()
{
float time;
printf("enter value time in 24 hr format\n");
scanf("%f%",&time);
if(time>=0 && time<=12)
{
printf(Good morning man!!!\n");
}
elseif(time>12 && time<=18)
{
printf(Good evening man!!!\n");
}
elseif(time>18 && time<=24)
{
printf("good night");
}
getch();
}