C语言:编写一个程序实现输出1—100之间所有素数。
#include <stdio.h>int main(void){ int i,j; for(i=2;i<=100;i++) { int count=0; for (j=2;j<=sqrt(i);j++) { if (i%j==0) { count++; } } if(count==0) { printf("%dn",i); } } return 0;}C语言:编写一个程序实现输出1—100之间所有素数。
#include <stdio.h>int main(void){ int i,j; for(i=2;i<=100;i++) { int count=0; for (j=2;j<=sqrt(i);j++) { if (i%j==0) { count++; } } if(count==0) { printf("%dn",i); } } return 0;}版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。