Solution | URI Online Judge | 1019 Time Conversion
URI Online Judge | 1019
Time Conversion
Adapted by Neilor Tonin, URI
Brazil
Timelimit: 1
Read an integer value, which is the duration in seconds of a certain event in a factory, and inform it expressed in hours:minutes:seconds.
Input
The input file contains an integer N.
Output
Print the read time in the input file (seconds) converted in hours:minutes:seconds like the following example.
Input Sample | Output Sample |
556 | 0:9:16 |
1 | 0:0:1 |
140153 | 38:55:53 |
সল্যুশন্সঃ
#include<iostream> using namespace std; main() { int N; cin >> N; int hour; int minute; int second; hour = (N/60)/60 ; int leftSnd1; leftSnd1 = N - (hour * 60 * 60); minute = leftSnd1 / 60; int leftSnd2; leftSnd2 = leftSnd1 - (minute * 60); cout << hour << ":" << minute << ":" << leftSnd2 << endl; return 0; }
আলোচনাঃ
কোনো টপিক না বুঝলে অবশ্যই কমেন্টস করবেন। কোড কপি পেষ্ট না করে আগে বুঝুন দেন নিজে নিজে করুন। কোডিং এর মজা টা বুঝবেন।
Comments
Post a Comment