TEMA

alguém poderia me dizer onde eu errei?

Maura Arieli Amâncio preguntado 11 months ago

#include<bits/stdc++.h>
int main(){
    int x,y,x2,aux;
    scanf("%d%d",&x,&y);
    if(x<y){
        aux=x;
        x=y;
        y=aux;
    }
    x2=x+1;
    do{ 
        if(x2%5==2)
            printf("%d\n",x2);
        else if(x2%5==3)
            printf("%d\n",x2);
    x2++;
    }
    while(x2!=y);
    return 0;
}

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

  • feodorv respondido 11 months ago

    You have here several errors.

        if(x<y){
            aux=x;
            x=y;
            y=aux;
        }

    Seems here you mean

    if( x > y ) ...

    Next one:

       x2=x+1;
        do{ 
           ...

    If the input is

    21
    22

    you code will print

    22

    which is wrong.