Program Description:

We are making a program to check wheather a number entered by the user is a prime number or not. Prime number is a number which is divisible only by itself and by 1. Also, after checking we we will ask the user wheather he wants to check another number or not. 1 to check another number and 0 to end the program.

Source code:

#include<stdio.h>
int main()
{
int check=1,n,i,p=0;
do
{
p=0;
printf("Enter a number:");
scanf("%d",&n);
for(i=1;i<=n;i++)
if(n%i==0)
p=p+1;
if(p==2)
printf("%d is a prime numnber\n",n);
else
printf("%d is not a prime number\n",n);
printf("Do you want to check another number?(1/0)    ");
scanf("%d",&check);
if (check==0)
break;
}
while(check==1);
printf("THANK YOU");
}


Output:



If you have any doubts or queries feel free to comment down below!!