Created
September 22, 2013 21:35
-
-
Save MaratB/6664076 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
#include <stdio.h> | |
#include <conio.h> | |
int Prime ( int N ); | |
main() | |
{ | |
int N; | |
printf ( "\nEnter integer: "); | |
scanf ( "%d", &N ); | |
if ( Prime(N) ) | |
printf ( "Integer is simple\n", N ); | |
else printf ( "Integer is composite\n", N ); | |
getch(); | |
} | |
int Prime ( int N ) | |
{ | |
for ( int i = 2; i*i <= N; i ++ ) | |
if ( N % i == 0 ) return 0; | |
else return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment