• + 1 comment

    Just a tip I've learned from my professors, you should rarely ever have to rewrite the same lines of code, see how your initial if and your default else are doing the same thing? You could condense this by doing this:

    if(n>38 && n%5 > 3)
    {
        cout << n+(5-n%5) << endl;
    }
    else
    {
        cout << n << endl;
    }
    

    Makes it still readable, but in less lines of code. Also, in Industry code it's generally good practice to use curly braces on the body of if statements to prevent any confusion.