ACP_U1p7.c

#include<stdio.h> #include<conio.h> struct time { int sec,min,hour; }; void time_diff(struct time t1,struct time t2); void main() { struct time t1,t2; clrscr(); printf("enter the first time\n"); printf("enter the seconds:"); scanf("%d",&t1.sec); printf("enter the min:"); scanf("%d",&t1.min); printf("enter the hour:"); scanf("%d",&t1.hour); printf("enter the second time\n"); printf("enter the seconds:"); scanf("%d",&t2.sec); printf("enter the min:"); scanf("%d",&t2.min); printf("enter the hour:"); scanf("%d",&t2.hour); printf("time1=%d %d %d\n",t1.hour,t1.min,t1.sec); printf("time2=%d %d %d\n",t2.hour,t2.min,t2.sec); time_diff(t1,t2); getch(); } void time_diff(struct time t1,struct time t2) { printf("Difference : %d hours %d min %d seconds",t1.hour-t2.hour,t1.min-t2.min,t1.sec-t2.sec); }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.