0
coutdown bug
When i execute the code it comes out correct but at the end of the code there is a empty line after 1. i think this is not letting me complete the challenge. #include <iostream> using namespace std; int main() { int n; cin >> n; //your code goes here for(int i=n;1<=n;n--){ cout<<n<<endl; if(0==n%5) cout<<"beep"<<endl; } return 0; }
3 Antworten
+ 3
Angel Jimenez 
There is Beep not beep
Also i is unused in your for loop. So do this:
for(int i = n; i > 0; i--){
        cout << i <<endl;
        
        if(0 == i % 5)
            cout << "Beep" << endl;
    }
+ 2
Thank you that makes sense of course haha
0
I also tried a do loop and had same results any help is good thank you,
   int n;
    cin >> n;
    
    //your code goes here
    do{
    cout<<n<<endl;
    if(0==n%5)
    cout<<"beep"<<endl;
    n--;
    }
    while(n>0);
    return 0;



