mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-07-27 08:51:41 +08:00
feat: Add count_of_trailing_ciphers_in_factorial_n (#1543)
* zeroes * Update bit_manipulation/count_of_trailing_ciphers_in_factorial_n.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Update bit_manipulation/count_of_trailing_ciphers_in_factorial_n.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Update bit_manipulation/count_of_trailing_ciphers_in_factorial_n.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Update bit_manipulation/count_of_trailing_ciphers_in_factorial_n.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Update bit_manipulation/count_of_trailing_ciphers_in_factorial_n.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * updating DIRECTORY.md * clang-format and clang-tidy fixes for537cd7e8* Update count_of_trailing_ciphers_in_factorial_n.cpp * Update bit_manipulation/count_of_trailing_ciphers_in_factorial_n.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Update bit_manipulation/count_of_trailing_ciphers_in_factorial_n.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Update bit_manipulation/count_of_trailing_ciphers_in_factorial_n.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Update bit_manipulation/count_of_trailing_ciphers_in_factorial_n.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * clang-format and clang-tidy fixes fora8c85e2dCo-authored-by: David Leal <halfpacho@gmail.com> Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: Abhinn Mishra <49574460+mishraabhinn@users.noreply.github.com>
This commit is contained in:
@@ -22,11 +22,11 @@ template <typename T>
|
||||
bool is_prime(T num) {
|
||||
bool result = true;
|
||||
if (num <= 1) {
|
||||
return 0;
|
||||
return false;
|
||||
} else if (num == 2) {
|
||||
return 1;
|
||||
return true;
|
||||
} else if ((num & 1) == 0) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
if (num >= 3) {
|
||||
for (T i = 3; (i * i) <= (num); i = (i + 2)) {
|
||||
@@ -47,7 +47,7 @@ int main() {
|
||||
assert(is_prime(50) == false);
|
||||
assert(is_prime(115249) == true);
|
||||
|
||||
int num;
|
||||
int num = 0;
|
||||
std::cout << "Enter the number to check if it is prime or not" << std::endl;
|
||||
std::cin >> num;
|
||||
bool result = is_prime(num);
|
||||
|
||||
Reference in New Issue
Block a user