#include<stdio.h> int main(){ int num; scanf("%d",&num); PrimeJudge(num); } PrimeJudge(int num){ int i; for( i=2;i<num;i++) { if(num%i==0) break; } if(num==i) printf("Prime"); else printf("No Prime"); }
#include<stdio.h> int main(){ int num; scanf("%d",&num); PrimeJudge(num); } PrimeJudge(int num){ int i; for( i=2;i<num;i++) { if(num%i==0) break; } if(num==i) printf("Prime"); else printf("No Prime"); }
转载于:https://www.cnblogs.com/sunli0205/p/6062092.html