Count Time

Enter the number of seconds and return Hours, Minutes, Seconds.

Count time in C.

Date Created:Thursday March 01st, 2007 04:34 PM
Date Modified:Saturday August 02nd, 2008 01:59 PM

#include <stdio.h>

int main()
    int hours;
    int minutes;
    int seconds;

    printf("Enter in the number of seconds:\n");
    scanf("%d", &seconds);

    hours seconds/3600;
    seconds -= hours*3600;

    minutes seconds/60;
    seconds -= minutes*60;    
    printf("%d hours\n%d minutes\n%d seconds"hoursminutesseconds);

    return 0;

Download: count_time.c 352 B

Please login or Click Here to register for downloads
Creative Commons License
Count Time by Dan Lynch
is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
Based on a work at
Permissions beyond the scope of this license may be available at