TOPIC
WRONG ANSWER(5%) EM MEU CÓDIGO...O QUE PODE SER?
MatteusGutemberg asked 3 years ago
#include <stdio.h>
int main(){
int hora_inicial, hora_final;
scanf("%d %d", &hora_inicial, &hora_final);
int somaHorasJogadas = 0;
if(hora_inicial == hora_final){
printf("O JOGO DUROU 24 HORA(S)\n");
}else{
if(hora_inicial >= 0 && hora_inicial <= 12){
for(int i = hora_inicial; i <= 12; i++){
if(hora_inicial == hora_final){
break;
}else{
somaHorasJogadas++;
}
}
}
if(hora_final > 12){
for(int j = 13; j <= hora_final; j++){
if(j == hora_final){
somaHorasJogadas = somaHorasJogadas;
}else{
somaHorasJogadas++;
}
}
}
if(hora_inicial >= 13 && hora_inicial <= 24){
for(int i = hora_inicial; i <= 24; i++){
if(hora_inicial == hora_final){
break;
}else{
somaHorasJogadas++;
}
}
}
if(hora_final < 13){
for(int j = 1; j <= hora_final; j++){
if(j == hora_final){
somaHorasJogadas = somaHorasJogadas;
}else{
somaHorasJogadas++;
}
}
}
printf("O JOGO DUROU %d HORA(S)\n", somaHorasJogadas);
}
return 0;
}