C program that receives an integer number and determines if it is a prime number
###### Posted by Samath
Last Updated: June 01, 2015

Write a C program that receives an integer number and determines if it is a prime number or not.

```#include <stdio.h>
#include <stdlib.h>

bool isPrime(int n);

int main(int argc, char *argv[])
{
int num;

scanf("%d", &num);

if(isPrime(num))
{
printf("%d is a prime number\n",num);
}
else
{
printf("%d is NOT a prime number\n",num);
}

}

bool isPrime(int n)
{
long i;
if (n < 2)
return false;

for (i = 2; i < n; i++)
{
if ((n % i) == 0)
return false;
}
return true;
}

```
###### C++ program that display all the prime numbers between 2 and 1000
Samath | Dec 24, 2014
###### Find Prime numbers using Python
Samath | Mar 02, 2015
###### C++ Print First n Prime Numbers
Samath | Jan 05, 2017
###### C program that determines if a number is equal to zero
Samath | Nov 07, 2014
###### C program that determines if a number is either positive, zero, or negative
Samath | Nov 07, 2014
###### C program that receives 10 float numbers from the console and sort them in nonascending order
Samath | Jun 01, 2015
###### C program that receives a positive float number and divides it by two until the result is less than or equal to zero
Samath | Jun 12, 2015
###### 10001'st prime number using Python (Project Euler Problem 7 Solution)
Samath | Jan 11, 2017
###### Python program that test if integer values can form a triangle
Samath | Nov 06, 2014
###### Java program that reads an integer and prints how many digits the number has
Samath | Feb 11, 2021
###### C++ Summing the digits in an integer
Samath | Jan 06, 2021
###### Recursive function that find the sum of digits in a integer using C++
Samath | Dec 24, 2014
###### Summing the Digits in an Integer using Python
Samath | Mar 02, 2015
###### Convert Integer to Roman Numeral using C#
Samath | Jan 20, 2024