个人资料
文章分类
归档
正文

A C++ interview question

(2007-07-17 20:54:58) 下一个
Write a C++/C function which prints out prime integers, i.e., given an input X, print out all its prime numbers. For example,

if X=20, prime elements will be: 1, 2, 3, 5, 7, 9, 11, 13, 17, 19.
If X= 100, primes are: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97.


void (int X)
{
???????
???????
}


Thanks.
[ 打印 ]
阅读 ()评论 (0)
评论
目前还没有任何评论
登录后才可评论.