Skip to content

Instantly share code, notes, and snippets.

@shohan4556
Created August 11, 2014 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shohan4556/7a04d8bca6686d63a8eb to your computer and use it in GitHub Desktop.
Save shohan4556/7a04d8bca6686d63a8eb to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main()
{
int i,num,count=0;
printf ("Enter the to test: ");
scanf ("%d",&num);
for(i=2;i<=num/2;i++){
if (num%i==0)
count++;
break;
}
if (count==0 && num!=1)
printf ("%d is Prime\n",num);
else
printf ("%d is not Prime",num);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment