Menu


.

Write a program to know whether number is prime or not.

#include< iostream.h >

#include< conio.h >

void main()

{

clrscr();

int a,b,j,i;

cout<<"Enter any range";

cin>>a>>b;

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

{

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

{

if(i%j==0)

{

break;

}

}

if(i==j)

cout<<i<<endl;

}

getch();

}




Enjoy our courses Today