Advertisement
What_Ever

Untitled

Dec 13th, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.63 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. struct time{
  4.     int seconds;
  5.     int minutes;
  6.     int hours ;
  7. };
  8. struct time splittime(long long totalseconds);
  9. int main()
  10. {
  11.     struct time x;
  12.     long long totalseconds;
  13.     printf("enter the total seconds ");
  14.     scanf("%lld",&totalseconds);
  15.     x=splittime(totalseconds);
  16.     printf("number of hours %d  minutes %d  seconds  %d ", x.hours  , x.minutes , x.seconds);
  17.     return 0;
  18. }
  19.  
  20. struct time splittime(long long totalseconds)
  21. {
  22.     struct time x;
  23.  
  24.      x.hours=totalseconds/3600;
  25.      x.minutes=totalseconds%3600/60;
  26.      x.seconds=totalseconds%3600%60;
  27.      return x ;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement