Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Project Euler("https://projecteuler.net/archives")
- Problem 5
- 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?
- */
- int main(){
- int num = 0, size = 10;
- bool check = true;
- for(int i = 1; i < 1000000000; i++){
- for(int j = 1; j < 20; j++){
- if(i%j != 0 ) check = false;
- }
- if(check == true) cout << i << endl;
- check = true;
- }
- system("PAUSE");
- }
Advertisement
Add Comment
Please, Sign In to add comment