Skip to main content

program to check whether a number is prime number or not.

#include<stdio.h>

int main()

{

    int a,i,j;

    printf("Enter a range of numbers to check prime number between them\n");

    printf("Enter the first number\n");

    scanf("%d",&i);

    printf("Enter the second number\n");

    scanf("%d",&j);

     for(a=i;a<=j;a++)

     {

    if (a%1==0&&a%a==0&&a%2!=0&&a%3!=0&&a%4!=0&&a%5!=0&&a%6!=0&&a%7!=0&&a%8!=0&&a%9!=0)

    {

        printf("%d is prime number\n",a);

    }

    else

    printf("%d is not a prime number\n",a);

     }

}

there is mistake in it find it out.

Comments