C Language program to convert hours to seconds

Views: 18   

Following program shows you how to convert hours to seconds.
In this program we get hours from user, once we get those we need to multiply with 60 so that we get in minutes, and once we get minutes we need to multiply with 60 so that we get in seconds

#include <stdio.h>

int main(void) {
    int hours;

    printf("Please enter hours:");
    scanf("%d", &hours);

    int seconds = hours * 60 * 60;

    printf("%d Seconds", seconds);
}

Output:

Please enter hours: 1000
3600000 Seconds
On By