C++ Program | Convert Seconds into Hours and Minutes | Hours into and weeks



Seconds into Hours and Minutes

 #include <iostream>

using namespace std;

int main()

 {

    int a, b, c, d;


    cout << "Enter the total number of Seconds: "; cin >> a;


    b = a / 3600;

    c = (a % 3600) / 60;

    d = a % 60;


    cout << "\nHours: " <<b<<  "\nMinutes: " <<c<< "\n Seconds: " <<d;


    return 0;

}


______________________________

 Hours  into and weeks



#include <iostream>
using namespace std;
int main() 
{
    int a,b,c,d;

    cout << "Enter the total number of Hours: ";
    cin >> a;

    
    b = a / 168;  
    c = (a % 168) / 24; 
d= a % 24; 

    cout << "Weeks: " << b << "\nDays: " << c << "\nHours: " <<d<< endl;

    return 0;
    
}

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !