Hello,
I have a small problem w/ this program:
Program a function seconds_from_int, that given a non-negativeinteger representing an amount of time such that the two last digits represent a number of seconds, the third and fourth digits (from the right) represent a number of minutes, and the remaining leading digitsrepresent a number of hours, computes the corresponding number of seconds. For example, seconds_from_int (210) returns 130; seconds_from_int (11929) returns 4769. If
the number is small and the digits for the hour, for the minutes or for the tens of seconds
are missing, they take the value z
ero, by convention.
Already coded:
Code:
#include <stdio.h>
#include <math.h>
/int seconds_from_int(int )
{
return
}
void exercise_1_2 (void)
{
int t;
while (scanf ("%d", &t) != EOF)
{
int z = seconds_from_int (t);
printf ("%d\n", z);
}
}
int main(void)
{
exercise_1_2();
return 0;
}
*/
1 min = 60
1 hour = 3600
int seconds_from_time(int hr, int mn, int sec)
{
return hr * 3600 + mn * 60 + sec;
}
/*