WAP to Print First N Prime Numbers.

#include<stdio.h>

#include<math.h>

int main()

{

    int n,a,b,i,j,k;

    printf("Enter the value of N = ");

    scanf("%d",&n);

         for(j=2;j<n;j++)

         {

                a=n%j;

                if(a==0)

                {

                printf("\n it is not a prime number \n");

                exit(1);

                }

         }

         printf("\nit is a prime number\n ");

}
WAP to Print First N Prime Numbers. WAP  to Print First N Prime Numbers. Reviewed by Unknown on 03:37 Rating: 5

No comments:

Powered by Blogger.