其他分享
首页 > 其他分享> > c里素数求法

c里素数求法

作者:互联网

  1. #include <stdio.h>#include <stdlib.h>/* run this program using the console pauser or add your own getch, system("pause") or input loop */int main() { //求100-200之内的素数 int i=0; for( i=100;i<=200;i++){ int j=2; //采用试除法 for( j=2;j<i;j++){ if(i%j==0){ break; } } if(j==i){ printf("%d\n",i); } } return 0;}

标签:getch,pause,int,求法,素数,100,include
来源: https://blog.csdn.net/weixin_56863206/article/details/122796057