TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
A simple program to check if the given number is Prime or not. More...
#include <cassert>
#include <iostream>
Go to the source code of this file.
Namespaces | |
namespace | math |
for assert | |
Functions | |
bool | math::is_prime (int64_t num) |
Function to check if the given number is prime or not. | |
static void | tests () |
Self-test implementations. | |
int | main () |
Main function. | |
A simple program to check if the given number is Prime or not.
A prime number is any number that can be divided only by itself and 1. It must be positive and a whole number, therefore any prime number is part of the set of natural numbers. The majority of prime numbers are even numbers, with the exception of 2. This algorithm finds prime numbers using this information. additional ways to solve the prime check problem: https://cp-algorithms.com/algebra/primality_tests.html#practice-problems
Definition in file check_prime.cpp.
int main | ( | void | ) |
Main function.
Definition at line 81 of file check_prime.cpp.
|
static |
Self-test implementations.
Definition at line 62 of file check_prime.cpp.