-2

What time is it?

#include <iostream> using namespace std; // We have n (n <= 10 000 000) seconds from the beginning of the day. What time will clock show? Format -> h:mm:ss int main() { int n, hours, minutes_t, minutes_u, seconds_t, seconds_u; cin >> n; hours = n / 3600 % 24; // f.e. 125489 / 3600 % 24 = 10 hours minutes_t = n / 60 % 60 / 10; // f.e. 125489 / 60 % 60 / 10 = 5 minutes (tens) minutes_u = n / 60 % 10; // f.e. 125489 / 60 % 10 = 1 minutes (units)

11/15/2017 6:59:19 PM

Dhirendra sahu

1 Answer

New Answer