Last active
January 11, 2019 07:40
-
-
Save kokubo-haruya/4d63e3c51c181d26439ffde114fc2dd1 to your computer and use it in GitHub Desktop.
Programming Basic No.10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main() | |
{ | |
int N,cnt,point,max,check; | |
printf("Pls enter the [MAX] number you want to judge the one which is a prime number\n"); | |
printf("->"); | |
scanf("%d",&max); | |
printf("2 is a prime number \n"); | |
for(N=3;N<=max;N++) | |
{ | |
point=0; | |
for(cnt=2;cnt<N-1;cnt++) | |
{ | |
check=N%cnt; | |
if(check==0) | |
{ | |
point++; | |
} | |
} | |
if(point==0) | |
{ | |
printf("%d is a prime number \n",N); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment