Write a program that inputs time in second and converts it into hh-mm-ss format.

 #include<iostream>

using namespace std;

int main()

{

int sec, s, m, h;

cout<<"\n Enter time in second: ";

cin>>sec;

h = sec/3600;

sec = sec % 3600;

m = sec / 60;

s = sec % 60;

cout<<"\n HH-MM-SS= "<<h<<":"<<m<< ":"<<s;

}

OUTPUT


 Enter time in second: 5300


 HH-MM-SS= 1:28:20

1 comment: