if (5>=hour && hour<9){
if(minute<7){
printf("%d:00");
return 0;}
else if (8<=minute && minute<22){
printf("%d:15",hour);
return 0;}
else if (22<=minute && minute<37){
printf("%d:30",hour);
return 0;}
else if (38<=minute && minute<52){
printf("%d:45",hour);
return 0;}
else{
hour+=1;
printf("%d:00");
return 0;}
After compiling the value of the code is completely off, what is wrong with my statements? I can make the code longer and make it work but I am trying to simplify it.
EDIT: Basically I am trying to say if I input "5:01" output should be "5:00" and if my input is "5:22" output should be "5:30".
However my output values comes out to be "2686748:00"
The line printf("%d:00");
should be:
printf("%d:00", hour);
See if you can turn up your compiler warning level, modern compilers tend to be able to warn about this sort of mistake.