Please click on 1-2 Ads to keep this website's Study Material FREE and regularly Updated.

Program 42: Write a C++ program to convert a given integer into hours,minutes and seconds.

using namespace std;

int main()
	int num,size=0,arr[3];
	cout<<"\nenter a number : ";

	for(int i=num;i>0;i/=60)

	cout<<"\ntime in hour:min:sec (H:M:S) = ";
	for(int i=2;i>=0;i--)
		cout<<arr[i]<<" ";
	return 0;

If you have any suggestion or found any error in the above program, then do let us know at [email protected] or just comment below.