标签:col class void count sign include main for ble
#include <stdio.h> int isPrime(unsigned int n)//定义素数函数 { int i; if(n == 0 || n == 1) return 0; for(i = 2; i * i <= n; i++) { if(n % i == 0) return 0; } return 1; } int main(void)//主函数 { int i,count=0; for(i = 100; i <= 200; i++) { if(isPrime(i)) { printf("%5d",i); count++; if(count%5==0)//满五个换行 printf("\n"); } } printf("\n"); return 0; }
Problem B: 调用函数,输出100到200之间的所有素数
标签:col class void count sign include main for ble
原文地址:https://www.cnblogs.com/chenlong991223/p/9893153.html