0
How to I make a multiple *5 loop
#include <iostream> using namespace std; int main() { int n; cin >> n; while (n >= 1){ cout << n << endl; n--; } if (n >= 1){ cout << "Beep" << endl; n%=5; } //your code goes here return 0; }
1 Respuesta
+ 5
Nik
if condition should be inside while loop
and there should be (n % 5 == 0) instead of (n >= 1) inside if condition.
remove n %= 5
if (n % 5 == 0) {
cout << "Beep";
}
n--; should be after if block