Hi,
I am trying to get the program to request and convert the time in seconds 3 times. If i use and IF statement ie IF(time>) then "execute code" it makes the code look really long and was wondering if there was a quicker (cleaner) way of doing it?
Code:
#include <stdio.h>
#include <time.h>
int main()
{
int hours, mins, secs,time;
printf( "Enter current time in the format <hours minutes seconds> \n");
scanf("%d %d %d", &hours, &mins, &secs);
time = (60 * hours + mins) * 60 + secs;
printf( "Time converted to seconds is: %d", time);
getchar();
}
thanks