Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- //31556926 - Гугъл
- //31536000 - Петър
- int main ()
- {
- long long int tot_sec, sec, min, hr, days,yrs;
- cout << "Enter seconds: ";
- cin >> tot_sec;
- yrs = tot_sec / 31536000;
- days = (tot_sec - (yrs*31536000)) / 84600;
- hr = (tot_sec - (yrs*31536000) - (days*84600)) / 3600;
- min = (tot_sec - (yrs*31536000) - (days*84600) - (hr*3600)) / 60;
- sec = (tot_sec - (yrs*31536000) - (days*84600) - (hr*3600) - (min*60));
- cout<<yrs<<"yrs," << days <<"days," << hr << "hrs," << min << "mins," << sec << "seconds" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement