Project Euler #5: Smallest multiple

  • + 0 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;
    }