Need help with COINS problem

I am getting wrong solution with this problem. Any help would be appreciated.

#include
using namespace std;

int main() {
int n;
int obs;
int n1,n2,n3;
int result;
for(int i=1;i<=10;i++){
cin >> n ;
if(n>=0 && n<=1000000000){
n1=n/2;
n2=n/3;
n3=n/4;
result=n1+n2+n3;
if(result>n){
cout << result<< endl;
}else {cout << n << endl;}
}
else break;
}
return 0;
}