Write a program to print a prime number

//this is a program to print a print number
#include<stdio.h>
#include<conio.h>
int main()
{
int num,i=1,flag=0,ori;

printf("\n\nEnter any number: ");
scanf("%d",&num);

ori=num;

while(i<num)
{
if(num%i==0)
{
flag=1;
}
i++;
}
if(flag==0)
{
printf("\n\nThe number %d is Prime",ori);
}
else
{
printf("\n\nThe Number %d is not Prime",ori);
}
getch();
}


Previous
Next Post »