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?
cevap : 232792560
#include <stdio.h>
#pragma hdrstop
#include <tchar.h>
// fonksiyon prototipleri
unsigned int okek_hesapla(unsigned int, unsigned int);
// global degiskenler
unsigned int a, b;
#pragma argsused
int _tmain(int argc, _TCHAR* argv[]) {
unsigned int okek;
b = 1;
for (a = 1; a<20; a++) {
okek = okek_hesapla(a, b);
b = okek;
}
printf("Sonuc = %d\n", okek);
system("pause");
}
unsigned int okek_hesapla(unsigned int sayi_1, unsigned int sayi_2) {
unsigned int i;
for (i=1; i<=sayi_1*sayi_2; i++ ) {
if ( i%sayi_1==0 && i%sayi_2==0) {
break;
}
}
return i;
}