My problem is when I testcase the first test that want only up to five how can make my code stop there? you'll see what I mean in the picture the test case was up to 15 which was correct
int main() {
for(int i=1;i<=15;i++){
if(i%3==0 && i%15==0)cout<<"FizzBuzz"<<endl;
else if(i%5==0) cout<<"Buzz"<<endl;
else if(i%3==0) cout<<"Fizz"<<endl;
else if(i%15==0) cout<<"FizzBuzz"<<endl;
else cout<<i<<endl;
}
return 0;
}
Expected output 1 2 Fizz 4 Buzz
my codes output is until 15: 1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz