/*
* Copyright (c) 2012, 烟台大学计算机学院
* All rights reserved.
* 作 者:耿娜
* 完成日期:2012 年 11 月 22日
* 版 本 号:v1.0
* 输入描述:无
* 问题描述: 无
* 程序输出:输出一万以内的所有所有素数
* 问题分析: 无
#include <iostream>
using namespace std;
int main()
{
int a;
for(a=1;a<=10000;a++)
{
if(a==1)
{
cout<<a<<" "<<endl;
}
bool b=true;
for(int j=2;j<a;j++){
if(a%j==0)
{
b=false;
}
}
if(b==true)
{
cout<<a<<" "<<endl;
}
}
return 0;
}