Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,x=0;
clrscr();
printf("\nEnter the no");
scanf("%d",&n);
for(i=2;i<=n/2;i++)
{
if(n%i==0)
x++;
}
if(x>1)
printf("\n the %d is prime",n);
else
printf("\n the %d is not prime",n);
getch();
}
Output
What is prime no?
the number which is not divisible by any other no except that no is called prime no
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,x=0;
clrscr();
printf("\nEnter the no");
scanf("%d",&n);
for(i=2;i<=n/2;i++)
{
if(n%i==0)
x++;
}
if(x>1)
printf("\n the %d is prime",n);
else
printf("\n the %d is not prime",n);
getch();
}
Output
What is prime no?
the number which is not divisible by any other no except that no is called prime no
No comments:
Post a Comment