Program to convert seconds into hour, minute and second format in C++

Using Visual Studio 2015

===============================================================


#include<iostream>
using namespace std;
#include<conio.h>
void main()
{
 int sec,hour,min;
 cout<<"Enter the seconds= ";
 cin>>sec;
 min=sec/60;
 hour=min/60;
 min=min%60;
 sec=sec%60;
 cout<<hour<<" Hours "<<min<<" minutes "<<sec<<" seconds";
 _getch();
  }


=========================================================================

Comments

Popular posts from this blog

Suppose you are given a square matrix of size n x n, write a program to determine if this is an identity matrix. 2D array

Program to create a multiplication table of a given number using while loop.

Program to find equal values using if statement in C++