You are viewing a single comment's thread. Return to all comments →
C++ code:
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int smallest_div(int n){ int i=0; bool continuer(true); while(continuer){ i++; continuer=false; for(int j=1;j<=n;j++){ if (i%j != 0){ continuer=true; continue; } } } return i; } int main() { int t, n; cin >> t; for(int line=0;line < t; line++){ cin >> n; cout << smallest_div(n) << endl; } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #5: Smallest multiple
You are viewing a single comment's thread. Return to all comments →
C++ code: