--> Time Conversion (beeCrowd- 1019) URI 1019 Solution C, Python | Alpha Codist

Search This Blog

Time Conversion (beeCrowd- 1019) URI 1019 Solution C, Python

Time Conversion beeCrowd 1019 URI 1019 Solution C Python coding programming int round floor int() py c solved problem competitive input output print a

Time Conversion



You have to read an integer value. This value is in seconds. All you have to do is convert it to hour:minute:second format.

The formula is:

  1. Take input.
  2. Convert the second to hours.
  3. Then subtract the number of seconds you converted.
  4. Now convert the remaining to minutes.
  5. At last, get the remaining seconds.
  6. Print as said.


The solution in C:


#include <stdio.h>

int main() {
 
    int seconds,minute,hour;
    scanf("%d",&seconds);
    hour =  seconds/3600;
    seconds =  seconds-(hour*3600);
    minute =  seconds/60;
    seconds =  seconds-(minute*60);
    printf("%d:%d:%d\n",hour,minute,seconds);
 
    return 0;
}


The solution in Python:


seconds = int(input())
hour =  int(seconds/3600)
seconds =  seconds-(hour*3600)
minute =  int(seconds/60)
seconds =  seconds-(minute*60)
print("%d:%d:%d" % (hour,minute,seconds));

COMMENTS

Name

beeCrowd,11,C,10,Computer,9,Downloads,3,HTML,1,My Creation,2,Python,24,Python-Soft,1,Shooting,2,
ltr
item
Alpha Codist: Time Conversion (beeCrowd- 1019) URI 1019 Solution C, Python
Time Conversion (beeCrowd- 1019) URI 1019 Solution C, Python
Time Conversion beeCrowd 1019 URI 1019 Solution C Python coding programming int round floor int() py c solved problem competitive input output print a
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJtBNn2UmvqWF-9CPYeoukdDfP05qH9YgMNbFYc3uRxWuRHTCVXeXFbmxxBJm8YKq-HufbMzMSzZbrrN8Xv4tenIdztqT10gNBuYOuE9s9QZ6MoFTPkpCT7aHMa6xGYLmaPcVYnvd9KYDaFXf0k8BclgxOWTOiJdsESq2Hwwuj2ScEknfAYqV6AU0JEQ/w640-h422/1019.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJtBNn2UmvqWF-9CPYeoukdDfP05qH9YgMNbFYc3uRxWuRHTCVXeXFbmxxBJm8YKq-HufbMzMSzZbrrN8Xv4tenIdztqT10gNBuYOuE9s9QZ6MoFTPkpCT7aHMa6xGYLmaPcVYnvd9KYDaFXf0k8BclgxOWTOiJdsESq2Hwwuj2ScEknfAYqV6AU0JEQ/s72-w640-c-h422/1019.png
Alpha Codist
https://alphacodist.blogspot.com/2022/11/timeconversion1019.html
https://alphacodist.blogspot.com/
https://alphacodist.blogspot.com/
https://alphacodist.blogspot.com/2022/11/timeconversion1019.html
true
7547834254111195316
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content