Skip to main content
Commonmark migration
Source Link

##Project Euler #5: Smallest multiple

Project Euler #5: Smallest multiple

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

 

What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?"

And I'm wondering if my code to solve this problem is good and if there are ways to make it better.

#include "stdafx.h"
#include <iostream>
int main(){
int smallestMultiple = 40;
int i = 10;

while (i<20){
    if (smallestMultiple%i == 0){
        i++;
        continue;
    }
    else{
        i = 10;
        smallestMultiple += 20;
    }
    }
std::cout << smallestMultiple;
}

##Project Euler #5: Smallest multiple

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

 

What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?"

And I'm wondering if my code to solve this problem is good and if there are ways to make it better.

#include "stdafx.h"
#include <iostream>
int main(){
int smallestMultiple = 40;
int i = 10;

while (i<20){
    if (smallestMultiple%i == 0){
        i++;
        continue;
    }
    else{
        i = 10;
        smallestMultiple += 20;
    }
    }
std::cout << smallestMultiple;
}

Project Euler #5: Smallest multiple

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?"

And I'm wondering if my code to solve this problem is good and if there are ways to make it better.

#include "stdafx.h"
#include <iostream>
int main(){
int smallestMultiple = 40;
int i = 10;

while (i<20){
    if (smallestMultiple%i == 0){
        i++;
        continue;
    }
    else{
        i = 10;
        smallestMultiple += 20;
    }
    }
std::cout << smallestMultiple;
}
added 81 characters in body
Source Link
Deduplicator
  • 19.9k
  • 1
  • 32
  • 65

##Project Euler #5: Smallest multiple

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?"

And I'm wondering if my code to solve this problem is good and if there are ways to make it better.

#include "stdafx.h"
#include <iostream>
int main(){
int smallestMultiple = 40;
int i = 10;

while (i<20){
    if (smallestMultiple%i == 0){
        i++;
        continue;
    }
    else{
        i = 10;
        smallestMultiple += 20;
    }
    }
std::cout << smallestMultiple;
}

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?"

And I'm wondering if my code to solve this problem is good and if there are ways to make it better.

#include "stdafx.h"
#include <iostream>
int main(){
int smallestMultiple = 40;
int i = 10;

while (i<20){
    if (smallestMultiple%i == 0){
        i++;
        continue;
    }
    else{
        i = 10;
        smallestMultiple += 20;
    }
    }
std::cout << smallestMultiple;
}

##Project Euler #5: Smallest multiple

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?"

And I'm wondering if my code to solve this problem is good and if there are ways to make it better.

#include "stdafx.h"
#include <iostream>
int main(){
int smallestMultiple = 40;
int i = 10;

while (i<20){
    if (smallestMultiple%i == 0){
        i++;
        continue;
    }
    else{
        i = 10;
        smallestMultiple += 20;
    }
    }
std::cout << smallestMultiple;
}
copy-edited
Source Link
Deduplicator
  • 19.9k
  • 1
  • 32
  • 65

so the problem is this:-

"2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?"

What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?"

And I'm wondering if my code to solve this problem is good and if there are ways to make it better.

#include "stdafx.h"
#include <iostream>
int main(){
int smallestMultiple = 40;
int i = 10;

while (i<20){
    if (smallestMultiple%i == 0){
        i++;
        continue;
    }
    else{
        i = 10;
        smallestMultiple += 20;
    }
    }
std::cout << smallestMultiple;
}

Thanks

so the problem is this:-

"2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?"

And I'm wondering if my code to solve this problem is good and if there are ways to make it better.

#include "stdafx.h"
#include <iostream>
int main(){
int smallestMultiple = 40;
int i = 10;

while (i<20){
    if (smallestMultiple%i == 0){
        i++;
        continue;
    }
    else{
        i = 10;
        smallestMultiple += 20;
    }
    }
std::cout << smallestMultiple;
}

Thanks

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?"

And I'm wondering if my code to solve this problem is good and if there are ways to make it better.

#include "stdafx.h"
#include <iostream>
int main(){
int smallestMultiple = 40;
int i = 10;

while (i<20){
    if (smallestMultiple%i == 0){
        i++;
        continue;
    }
    else{
        i = 10;
        smallestMultiple += 20;
    }
    }
std::cout << smallestMultiple;
}
Source Link
Loading