20151015查找素数

#include <stdio.h>
#include <Windows.h>
int main()
{
    int m, n,num;
    printf("输入查找范围:从1到");
scanf("%d",&num); 
    for(m=2; m<=num; m++)
    {
for(n=2; n<=m; n++)
        {
            if(   m%n==0    )       
              break;                
} 
        if(m == n)   
            printf("%d  ", m);
}
system("pause");
return 0;    
}



posted on 2017-10-05 18:17  sunshineman1986  阅读(101)  评论(0)    收藏  举报

导航