I'm getting a compilation error in the URI site judgment in question 1046, although it's working perfectly on my Code Blocks. Question:
Mycode
#include<stdio.h>#include<stdlib.h>intmain(){inthr_inicial,hr_final,duracao;scanf("%d %d", &hr_inicial, &hr_final);
if((hr_inicial <= 24) && (hr_inicial >= 0) && (hr_final <= 24) && (hr_final >= 0)){
if(hr_inicial == 24){
hr_inicial = 0;
}
if(hr_inicial < hr_final){
duracao = hr_final - hr_inicial;
}
if (hr_inicial > hr_final){
for(int i = 1; i <= 24; i++){
hr_inicial++;
if(hr_inicial == 24){
duracao = i;
i = 1;
}
if(i == hr_final){
duracao += i;
}
}
}
if(hr_inicial == hr_final){
duracao = 24;
}
printf("O JOGO DUROU %d HORA(S)\n", duracao);
}
return 0;
}
What can I do wrong?