Advertisement
desislava_topuzakova

01. Sum Seconds

Jan 17th, 2021
792
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int time1, time2, time3;
  7.     cin >> time1 >> time2 >> time3;
  8.  
  9.     int sum = time1 + time2 + time3;
  10.     int minutes = sum / 60;
  11.     int seconds = sum % 60;
  12.  
  13.     if (seconds < 10) {
  14.         cout << minutes << ":0" << seconds << endl;
  15.     }
  16.     else {
  17.         cout << minutes << ":" << seconds << endl;
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement