> ## Documentation Index
> Fetch the complete documentation index at: https://learn.acadlink.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Check Prime Using Function

> Check whether a number is prime using a user-defined function.

## Problem Statement

Write a C program with a user-defined function to check whether a given number is prime or not.

## Solution

```c theme={null}
#include <stdio.h>

int isPrime(int n) {
    if (n < 2) return 0;
    for (int i = 2; i * i <= n; i++)
        if (n % i == 0) return 0;
    return 1;
}

int main() {
    int n;
    scanf("%d", &n);
    printf(isPrime(n) ? "Prime\n" : "Not Prime\n");
    return 0;
}
```

## Input

```
17
```

## Output

```
Prime
```
