hours minutes and seconds in both 12 and 24 hours format


Levels of difficulty: / perform operation:

C++ Program

#include <iostream>
void main() {
	clrscr();
	int hours,mins,seconds,x;
	cout<>hours;
	cout<>mins;
	cout<>seconds;
	if(hours > 24) {
		cout<<"Invalid Entery";
	} else {
		cout<<"\n24 Hours Format\n";
		cout<<"Hours  :  Mins  :  Seconds\n"<<"  "<<hours<<"  :     "<<mins<<"   :     "<<seconds< 12) {
			hours=hours-12;
			cout<<"12 Hours Format\n";
			cout<<"Hours  :  Mins  :  Seconds\n"<<"  "<<hours<<"  :     "<<mins<<"   :     "<<seconds;
		} else {
			cout<<"12 Hours Format\n";
			cout<<"Hours  :  Mins  :  Seconds\n"<<" "<<hours<<": "<<mins<<"   :        "<<seconds;
		}
	}
}
// end of main





Quantitative Aptitude
Reasoning
Programming
Interview