I have running totals of int minutes and int seconds and I can display them as mmm:sss, but I need to convert them into hh:mm:ss. Any ideas? Thanks in advance for your help.
rookieNeedsHelp
0
Newbie Poster
Recommended Answers
Jump to PostHere is a code for your query
#include<stdio.h> #include<conio.h> void main() { unsigned int time,hour,mins,secs; printf("enter time in secs"); scanf("%d",&time); g1: if(time!=0) { hour=time/3600; time=time%3600; mins=time/60; time=time%60; secs=time; printf("hours=%d\nmins=%d\nsecs=%d",hour,mins,secs); } else { printf("enter minutes and secs"); scanf("%d%d",&mins,&secs); time=(mins*60)+secs; goto g1; } getch(); }
The above code …
All 3 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.