Write a program to extract integral and fractional parts of a floating point numbers.
#include <iostream>
using namespace std;
int main ()
{
int seconds, hours, minutes;
cout<<"time in seconds:";
cin >> seconds;
minutes = seconds / 60;
hours = minutes / 60;
cout << seconds << " seconds is equivalent to " << int(hours) << " hours " << int(minutes%60)
<< " minutes " << int(seconds%60) << " seconds.";
}
0 Comments
Post a Comment