TEMA

Why 10% wrong?:(

CUET SCHOOL CLASS-IX preguntado 2 years ago

include

int main() { int a,i,b; scanf("%d%d",&a,&b); if(a<b){ for(i=a;i<b;i++){ if(i%5==2||i%5==3){ printf("%d\n",i); } } } else if(a>b){ for(i=b;i<a;i++){ if(i%5==2||i%5==3){ printf("%d\n",i); } } }

}

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

  • Kitkat respondido 2 years ago

    This is just a guess, but it makes sense to me:

      for( i= a+1; i<b; i++){
            code;
           }
       --- // -- // ---
       for(i=b+1; i<a; i++){
       code;
       }
    

    // Just add +1 in your first a and b (guessing there are == 10), because if you dont do that, URI will start dividing num%5 == 2; and just add num as an input inside the loop FOR. You want to start after 10 or any beggining number.