TEMA

"Compilation error"

ManoelMoura preguntado 3 years ago

//O código está funcionando, é aceito em C++, mas em C apresenta "Compilation error"!


#include <stdio.h>

int main(void) {

      int n,x,y,soma = 0;

      scanf("%d",&n);

      for(int i = 0; i < n; i++){

            scanf("%d %d",&x,&y);

            if( x < y){
                for(x += 1; x < y; x++){
                    if(x % 2 != 0){
                      soma += x;
                    }
                }
            }else if( x > y){
                for(y += 1; y < x; y++){
                    if(y % 2 != 0){
                      soma += y;
                    }
                }
            }
            printf("%d\n",soma);
            soma = 0;
      }
      return 0;
}

Recuerda no enviar soluciones. Tu mensaje puede ser revisado por nuestros moderadores.