Created
February 8, 2015 19:24
-
-
Save shohan4556/6320552d1815e63dd419 to your computer and use it in GitHub Desktop.
wilson's thorem implemt in C
This file contains hidden or 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,m,i,p,fact; | |
| while(scanf("%d",&n)==1){ | |
| fact=1; | |
| m=n; | |
| for(i=1;i<=n-1;i++){ | |
| fact=(fact*i) %m; | |
| } | |
| if (fact==n-1) | |
| printf("%d is prime\n",n); | |
| else | |
| printf("%d is not prime\n",n); | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment