Check Whether Number is Prime or not

#include<stdio.h>
int main()
{
    int num,i,count=0;
    printf("nEnter a number:");
    scanf("%d",&num);
    for(i=2;i<=num/2;i++){
        if(num%i==0){
         count++;
            break;
        }
    }
   if(count==0)
        printf("%d is a prime number",num);
   else
      printf("%d is not a prime number",num);
   return 0;
}

Share this

Related Posts

Previous
Next Post »

:)
:(
hihi
:-)
:D
=D
:-d
;(
;-(
@-)
:P
:o
:>)
(o)
:p
:-?
(p)
:-s
(m)
8-)
:-t
:-b
b-(
:-#
=p~
$-)
(y)
(f)
x-)
(k)
(h)
cheer