Before know the source code we need to understand the concept about primat number .
what is prime number?
>>The number which is only divisible by 1 or itself.
>>The number which do not come in others numbers multiplication table .
To check the given number is prime ,firstly user must input the number .After getting number from the user ,we need to divide that number by each 1 to n (input number) by using for loop .then we need to count how many times input number is perfectly divided.
If count is equal to 2 ,that means the input number is divided by 1 or itself,that means input number is a prime number.
The source code is given below and output also:
printf(“enter a number to check prime\n “);
printf(“not a prime number”);
enter a number to check prime 7 prime number