Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Elapsed Time in Seconds

Program

#include<iostream>
using namespace std;
const int seconds_per_hour=3600;
const int seconds_per_minute=60;
int main()
{
int hrs, mins, secs;
int elapsed;
cout<<"Enter the number of Hours: ";
cin>>hrs;
cout<<"Minutes: ";
cin>>mins;
cout<<"Seconds";
cin>>secs;

elapsed=seconds_per_hour*hrs+seconds_per_minute*mins+secs;
cout<<"Elapsed Time in Seconds:"<<elapsed<<endl;
return 0;
}
Test

You might also like