#include <stdio.h> main() { int a,b,c,d=0,sum=0; printf("100-200间所有质数:"); for(a=100;a<=200;a++) { c=0; for(b=2;b<a;b++) if(a%b==0) { c=1; break; } if(c==0) { d++; sum=sum+a; if(d==1) printf("%d",a); else printf(",%d",a); } } printf("\n100-200间所有质数和:%d",sum); getchar(); }
标签:200,质数,C语言,逗号,格式,100 From: https://www.cnblogs.com/xkdn/p/17134195.html