64. WAP to check if the given number is prime number or not (Part 3)

 #include<stdio.h>

void main()

{

        int num,i;

        printf("WAP to check if the given number is prime number or not\n");

        printf("Enter a number : ");

        scanf("%d",&num);

        for(i=2;i<num;i++)

        {

                if((num%i)==0)

                break;

        }

        if(num==i)

                printf("Its a prime number\n");

        else

                printf("Its not a prime number\n");

 

}

Comments