Created
August 4, 2014 04:42
-
-
Save shohan4556/5afe8e64c8f7d5dc4275 to your computer and use it in GitHub Desktop.
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
int main() | |
{ | |
int i,n,x; | |
printf("Enter a positive number to check prime"); | |
scanf("%d",&n); | |
x = sqrt(n); | |
for(i=2;i<=x;i++) | |
{ | |
if(n%i==0) | |
break; | |
} | |
if(n>1 && i == x+1) | |
printf(“This is a prime number”); | |
else | |
printf(“This isn’t a prime number”); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment