View Code of Problem 56

#include<stdio.h>
int main()
{
	int h,m,s;
	int h1,m1,s1;
	int h2,m2,s2;
	int x1,x2;
	scanf("%d:%d:%d",&h,&m,&s);
	scanf("%d:%d:%d",&h1,&m1,&s1);
	
	x1=s+m*60+h*60*60;
	x2=s1+m1*60+h1*60*60;
	
	if(x1>x2){
		int t=x1-x2;
		h=t/3600;
		m=t%3600/60;
		s=t%3600%60
		printf("%d:%02d:%02d",h2,m2,s2);
		
	}else{
		int t=x2-x1;
		h2=t/3600;
		m2=t%3600/60;
		s2=t%3600%60;
		printf("%d:%02d:%02d",h2,m2,s2);
	}
	return 0;
}
/*
Main.c: In function 'main':
Main.c:18:14: error: expected ';' before 'printf'
   s=t%3600%60
              ^
              ;
   printf("%d:%02d:%02d",h2,m2,s2);
   ~~~~~~      
*/

Double click to view unformatted code.


Back to problem 56