These two codes lead to different result, I don't find the reason, could someone help me, please?

CODE1

```
v[i] = (v[i+1] + ( s[i] == '1' || (s[i] =='2' && i + 1 < n &&s[i+1]<='6')) ? v[i+2] : 0);
```

CODE2

```
if(s[i] == '1' || (s[i]=='2' && i+1 < n && s[i+1] <='6')){
v[i] = v[i+1] + v[i+2];
}
else{
v[i] = v[i+1];
}
```