Failed on 1st and last task: Solution: 56105714 | CodeChef

AC Solution: Solution: 56106526 | CodeChef

Diff:

AC solution uses a break statement

```
for(int i = primes;i > 0;i--){
if(n%i == 0){
ans = i;
break;
}
}
cout << ans << "\n";
```

failed one using return

```
for(int i = primes;i > 0;i--){
if(n%i == 0){
cout << i << "\n";
return;
}
}
```

Why does it fail if both are same logically?