Advertisement
csansoon

P4.11 P22654 Time decomposition (2)

Oct 24th, 2018
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void decompose(int n, int& h, int& m, int& s) {
  5.     h=n/3600;
  6.     n=n%3600;
  7.     m=n/60;
  8.     s=n%60;
  9. }
  10.    
  11.    
  12.    
  13. int main(){
  14.     int n, h=0, m=0, s=0;
  15.     cin >> n;
  16.     decompose(n,h,m,s);
  17.     cout<<h<<" "<<m<<" "<<s<<endl;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement