Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int day1,day2,hour1,hour2,min1,min2,sec1,sec2,w,x,y,z,strt,end,time;
- char dia1[5],del[5],dia2[5];
- scanf("%s %d %d %s %d %s %d",dia1,&day1,&hour1,del,&min1,del,&sec1);
- scanf("%s %d %d %s %d %s %d",dia2,&day2,&hour2,del,&min2,del,&sec2);
- strt=sec1+min1*60+hour1*3600+day1*86400;
- end=sec2+min2*60+hour2*3600+day2*86400;
- time=end-strt;
- w=time/86400;
- x=(time-w*86400)/3600;
- y=(time-w*86400-x*3600)/60;
- z=(time-w*86400-x*3600-y*60);
- printf("%d dia(s)\n",w);
- printf("%d hora(s)\n",x);
- printf("%d minuto(s)\n",y);
- printf("%d segundo(s)\n",z);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment