avr39ripe

secToMin

Jan 12th, 2021
167
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.  
  3. int main()
  4. {
  5.     const int secInMin{ 60 };
  6.     int sec{ 75 };
  7.     int min{ 0 };
  8.  
  9.     std::cout << " Enter seconds: ";
  10.     std::cin >> sec;
  11.  
  12.     min = sec / secInMin;
  13.     sec %= secInMin;
  14.  
  15.     std::cout << min << ":" << sec << '\n';
  16.  
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment