Advertisement
Primitiv0

Seconds to Hours, Minutes & Seconds

Sep 10th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6.  
  7. {
  8.     int num,horas,mins,seg;
  9.    
  10.     cout << "Este programa convierte segundos a minutos y segundos \n";
  11.    
  12.     cout<<"Ingrese los segundos"<<endl;
  13.    
  14.     cin>>num;
  15.    
  16.     mins = num / 60;
  17.     seg = num % 60;
  18.     horas = mins / 60;
  19.     mins = mins % 60;
  20.    
  21.     cout<<"Son "<<horas<< "h "<<mins<<"m "<<seg<<"s";
  22.    
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement