Write a program to read number and identifies whether the given number is a prime number or not.

#include<stdio.h>
#include<conio.h>
void main()
{
int i, num;
printf("\n Enter a number:");
scanf("%d",&num);
for(i=2;i<num;i++)
{
if(num%i==0)
{
printf("\n Not prime!!");
break;
}
}
if(i==num)
{
printf("\n prime Numbers!!");
}
}

Comments

Popular posts from this blog