#include <iostream>
using namespace ::std;
int main()
{
int primes[] = {2,3,5,7,11,13,17,19,23};//up to 22 numbers
int n = 1;
int temp;
int nums = 20;
for(int i=0; primes[i] <= nums; i++)
{
temp = 1;
while(temp < nums)
{
if(temp * primes[i] <= nums)
{
temp *= primes[i];
}
else {break;}
}
n *= temp;
}
cout << n;
cin >> n;//pause
return 0;
}
Thursday, May 19, 2011
Problem 5 (C++)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment