View Code of Problem 56

#incldue <stdio.h>
int main(){
  int a[3];
  int b[3];
  long t1,t2;
  scanf("%d%d%d",a,a+1,a+2);
  scanf("%d%d%d",b,b+1,b+2);
  t1 = a[0]*60*60+a[1]*60+a[2];
  t2 = b[0]*60*60+b[1]*60+b[2];
  t1= t2-t1;
  printf("%c",t1>0?'':'-');
  t1=t1>0?t1:-1*t1;
  printf("%d:",t1/3600);
  t1 = t1%3600;
  printf("%d:",t1/60);
  printf("%d",t1%60);
  
}
/*
Main.c:1:2: error: invalid preprocessing directive #incldue
 #incldue <stdio.h>
  ^
Main.c: In function 'main':
Main.c:6:3: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   scanf("%d%d%d",a,a+1,a+2);
   ^
Main.c:6:3: warning: incompatible implicit declaration of built-in function 'scanf'
Main.c:11:3: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   printf("%c",t1>0?'':'-');
   ^
Main.c:11:3: warning: incompatible implicit declaration of built-in function 'printf'
Main.c:11:20: error: empty character constant
   printf("%c",t1>0?'':'-');
                    ^
Main.c:13:3: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long int' [-Wformat=]
   printf("%d:",t1/3600);
   ^
Main.c:15:3: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long int' [-Wformat=]
   printf("%d:",t1/60);
   ^
Main.c:16:3: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long int' [-Wformat=]
   printf("%d",t1%60);
   ^
*/

Double click to view unformatted code.


Back to problem 56