PROFESSOR_AIH

event time

Mar 28th, 2022
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int day1,day2,hour1,hour2,min1,min2,sec1,sec2,w,x,y,z,strt,end,time;
  5.     char dia1[5],del[5],dia2[5];
  6.     scanf("%s %d %d %s %d %s %d",dia1,&day1,&hour1,del,&min1,del,&sec1);
  7.     scanf("%s %d %d %s %d %s %d",dia2,&day2,&hour2,del,&min2,del,&sec2);
  8.     strt=sec1+min1*60+hour1*3600+day1*86400;
  9.     end=sec2+min2*60+hour2*3600+day2*86400;
  10.     time=end-strt;
  11.     w=time/86400;
  12.     x=(time-w*86400)/3600;
  13.     y=(time-w*86400-x*3600)/60;
  14.     z=(time-w*86400-x*3600-y*60);
  15.  
  16.     printf("%d dia(s)\n",w);
  17.     printf("%d hora(s)\n",x);
  18.     printf("%d minuto(s)\n",y);
  19.     printf("%d segundo(s)\n",z);
  20.  
  21.     return 0;
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment