TOPIC

wrong 5 % please help

Murad theOZ asked 10 months ago

please help me. what is wrong here!!

include

int main(){

int a,b,c,d;
scanf("%d %d", &a,&b);
c = (a /b);
d =(a % b);
if(a % b < 0){
    c = c - 1;
    d = ( a - (b * c) );

}
printf("%d %d\n", c,d);
return 0;

}

Remember not post solutions. Your post may be reviewed by our moderators.

  • feodorv replied 10 months ago

    You can consider the following input

    -2 -3

    Correct answer is

    1 1

    Your solution gives

    -1 -5