C program

Status
Not open for further replies.
Hello brothers, hey could anybody pleaser help me out. I need to write a program in C language that converts time from 24 hours notation to 12 hour notation, and Im sort of lost, Id appreciate from the heart your help.

This is what I should get, for instace, inputa time as two integers: 14 25
anf my outpu should be: that is 2 25 in 12 hour notation.

Please help.
 
Schoolwork, eh?

Not going to write the whole program.. This is the beef that actually does the "conversion". If you don't understand what this is or does, then you need to read up on basics of C..

Code:
int toTwelve(int hour)
{
   if(hour > 12)
   {
      return(hour - 12);
   }
   else
   {
      return(hour);
   }
}
 
Status
Not open for further replies.
Back