1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#include <stdio.h>
#include <math.h>
int secs(int, int, int); /*function prototype statement*/
int main()
{
/*variable to store time; hour, min and sec*/
int hr, min, sec, time;
/*Function prototype*/
int secs(int, int, int);
printf("Enter a Number of hours: ");
scanf("%d", &hr);
printf("Enter a Number of hours: ");
scanf("%d", &hr);
printf("Enter a Number of hours: ");
scanf("%d", &hr);
/*function calling statement*/
time = secs(hr, min, sec);
printf("The total no. of seconds ... %d\n", time);
return 0;
}
int secs(int h, int m, int s)
{
int total;
total = h*60*60+m*60+s;
return (total);
}
|