Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int r(double d) {
- double r = d - int(d);
- if (r < 0.5) {
- return int(d);
- } else {
- return int(d) + 1;
- }
- }
- int main() {
- double a, b, c;
- cin >> a >> b >> c;
- double s = 0;
- s = r(c / 6);
- if (s == 60) {
- s = 0;
- }
- double m = r((b - (s / 10)) / 6);
- if (m == 60) {
- m = 0;
- }
- double h = r((a - (s / 600) - (m / 10)) / 30);
- if (h == 60) {
- h = 0;
- }
- if (h < 10)
- cout << "0";
- cout << h << ":";
- if (m < 10)
- cout << "0";
- cout << m << ":";
- if (s < 10)
- cout << "0";
- cout << s << "\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement