C++ program to convert seconds into hours minutes and seconds

//program to convert seconds into hours minutes and seconds
#include <iostream>
using namespace std;

 int main()
   {
       int sec,min,hr,sec1;
       cout<<"Enter seconds : ";
       cin>>sec;
       hr=sec/3600;
       sec=sec%3600;
       min=sec/60;
       sec1=sec%60;

       cout<<"\nNumber of hours = "<<hr<<endl;
       cout<<"Number of minutes = "<<min<<endl;
       cout<<"Number of seconds = "<<sec1<<endl;

      return 0;
   }


1 comment:

  1. Design a program to find number of minutes and number of seconds from given number of
    years.

    ReplyDelete