C Program To Convert Time into Minutes
Learn How To Convert Time into Minutes in C Programming Language. This C Program gets Hours and Minutes from the User and Converts it into Total Number of Minutes. You can further modify the code to convert the Time in Seconds and Milliseconds too.
C Program To Convert Time into Minutes without Functions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #include<stdio.h> int main() { int hours, minutes, total_minutes; printf("\nEnter the Time in Hours and Minutes:\n"); printf("\nHours:\t"); scanf("%d", &hours); printf("\nMinutes:\t"); scanf("%d", &minutes); total_minutes = (hours * 60) + minutes; printf("\nTotal Time in Minutes:\t%d\n", total_minutes); return 0; } |
C Program To Convert Hours into Minutes using Functions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include<stdio.h> int convert_to_minutes(int h, int m) { int total_minutes; total_minutes = (h * 60) + m; return total_minutes; } int main() { int hours, minutes, total_minutes; printf("\nEnter the Time in Hours and Minutes:\n"); printf("\nHours:\t"); scanf("%d", &hours); printf("\nMinutes:\t"); scanf("%d", &minutes); total_minutes = convert_to_minutes(hours, minutes); printf("\nTotal Time in Minutes:\t%d\n", total_minutes); return 0; } |
Output

In case you get any Compilation Errors or any doubts in this C Program For Time Conversion, let us know about it in the Comment Section below.
Awesome code for conversion of hours into minutes in c. Thanks