```
/* Function to find prime number if so return 1 else return 0 */
#include<stdio.h>
#include<math.h>
int isprime( int num )
{
int i ;
int sq = ( int ) sqrt ( num );
/* here check should be done for num = 0 and 1 other wise 0 and 1 are printed as primes */
/* if ( num <= 1) return 0; */
for ( i = 2 ; i <= sq ; i++ )
{
if ( num % i == 0 )
{
break ;
}
}
if ( i <= sq )
return 0;
else
return 1 ;
}
```

```
int main( void )
{
int num , ch;
while ( 1 )
{
printf("Enter a Num : ");
scanf("%d", &num);
if ( isprime( num ) )
printf("Num ( %d ) is prime \n" , num);
else
printf("Num ( %d ) is not prime \n", num);
printf("Press < Enter > to continue \n");
if ( ( ch = getchar() ) != '\n' )
break ;
}
return 0;
}
```

in many of the previous posts i dint observe the check for 0 and 1.

please let me know whether this method is correct or not.