MACROS3 - printf("enter the second time format...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
//difference between two time// / #define getsec(hr,min,sec) hr*3600+min*60+sec #include<stdio.h> #include<conio.h> # void main (void) { int hr,min,sec,t1,t2,t,fhr,fmin,fsec; clrscr(); printf("enter the first time formate 10:20:30 "); scanf("%d:%d:%d",&hr,&min,&sec); t1=getsec(hr,min,sec);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: printf(&quot;enter the second time format 10:20:30 &quot;); scanf(&quot;%d:%d:%d&quot;,&amp;hr,&amp;min,&amp;sec); t2=getsec(hr,min,sec); if(t1&gt;t2) t=t1-t2; else t=t2-t1; fsec=t%60; t=t/60; fmin=t%60; fhr=t/60; printf(&quot;The difference between two time is %d:%d:%d&quot;,fhr,fmin,fsec); getch(); }...
View Full Document

This note was uploaded on 11/06/2010 for the course UBIT 411 taught by Professor Saleemelahi during the Spring '10 term at University of Karachi.

Ask a homework question - tutors are online