// Write a program to enter a number and check number prime or, not? //
program :
#include<stdio.h>
#include<conio.h>
void main()
{
int no,i,count=0;
printf("\n Enter the value of no= ");
scanf("%d",&no);
for(i=1; i<=no; i++)
{
if(no%i==0)
{
count++;
}
}
if(count==2)
{
printf("\n No is prime");
}
else
{
printf("\n No is not prime");
}
getch();
}
No comments:
Post a Comment