码迷,mamicode.com
首页 > 其他好文 > 详细

实验四4

时间:2019-05-20 19:25:01      阅读:94      评论:0      收藏:0      [点我收藏+]

标签:mic   printf   []   mat   \n   style   div   alt   com   

# include <stdio.h>
# include <math.h> 
int main(int argc, char* argv[])
{
    int i,j,k,n;
    int a[100];
    n=sqrt(100);
    for(j=2;j<=n;j++)
    {
        if(a[j]!=1)
        {
            for(k=2;k<=100/j;k++)
            {
                a[k*j]=1;
                
            }
            
        }
        
        
    }
    for(k=2;k<=100;k++)
    {
        if(a[k]!=1)
        printf("%d\n",k);
    }
    return 0;
}

 

 

技术图片

 

实验四4

标签:mic   printf   []   mat   \n   style   div   alt   com   

原文地址:https://www.cnblogs.com/P201821440046/p/10895808.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!