Home » C Programs » Prime or Not in C Using Function

Prime or Not in C Using Function

In this program, we can find whether the number is prime or not. 

Prime Number Definition in C

Prime numbers are those that have only two elements, namely one and the number itself. To put it another way, prime numbers can only be divided by one and the number itself. 

That is, they cannot be divided by any other number. A prime number is a number higher than one that is not the product of two lesser natural numbers. A composite number is a natural number greater than 1 that is not prime. 

Function Definition in C

A function is a collection of statements that work together to complete a task. Every C program contains at least one function, main(), and even the simplest programmes can specify more functions. 

The name, return type, and parameters of a function are all specified in a function declaration. A function is a logical unit of code that is frequently defined by its place in a larger code structure. 

A function is a unit of code that works on a variety of inputs, many of which are variables, and provides real outcomes such as changing variable values or doing actual operations based on the inputs. By using this function method we have executed the prime or not in c using function 

Prime or Not in C Using Function

//prime or not in c using function 
int main()
int num,res=0;
printf("\nEnter The Number");
printf("\n%d Is a Prime Number",num);
printf("\n%d Is a Not Prime Number",num);
int prime(int n)
int i;
return 1;
return 0;

Enter The Number 45
45 Is a Not Prime Number