Prime or not in c using the function for beginners. 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.

## Prime or Not in C Using Function

```
#include<stdio.h>
int main()
{
int num,res=0;
printf("\nEnter The Number");
scanf("%d",&num);
res=prime(num);
if(res==0)
printf("\n%d Is a Prime Number",num);
else
printf("\n%d Is a Not Prime Number",num);
}
int prime(int n)
{
int i;
for(i=2;i<=n/2;i++)
{
if(n%i!=0)
continue;
else
return 1;
}
return 0;
}
```

Output:

Enter The Number 45

45 Is a Not Prime Number

Linear Search in C Program Using Array

Insertion Sort Program in C Using Array

Bubble Sort Program in C Using Function

Bubble Sort in C Program Example

Binary Search in C Program Using Function

Prime or Not in C Using Function

LCM of Two Numbers in C Using For Loop

LCM of Two Numbers in C Using Recursion