Headlines
Loading...
C Program to print prime numbers between n1 and n2 where n1 and n2 are user inputs

C Program to print prime numbers between n1 and n2 where n1 and n2 are user inputs

C Program to print prime numbers between n1 and n2 where n1 and n2 are user inputs

#include<stdio .h="">
#include<conio .h="">
void main()
{
int n1,n2,i,j;
clrscr();
printf("\nEnter the numbers:");
scanf("%d%d",&amp;n1,&amp;n2);
printf("\nPrime Numbers:");
for(i=n1;i&lt;=n2;i++)
{
for(j=2;i&lt;=i;j++)
{
if(i%j==0)
break;
}
if(j==i)
printf("\n%d",i);
}
getch();
}

***********OUTPUT**************

Enter the numbers:1
10

Prime Numbers:
2
3
5
7</conio></stdio>
*** PLEASE checkout the Best deals from for top sites like Amazon, Flipkart etc ***