Skip to content

Instantly share code, notes, and snippets.

@MaratB
Created September 22, 2013 21:35
Show Gist options
  • Save MaratB/6664076 to your computer and use it in GitHub Desktop.
Save MaratB/6664076 to your computer and use it in GitHub Desktop.
#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