From 351a1b712a982f72396559be40e7dd37d9b6db2c Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Thu, 25 Jun 2020 09:51:24 +0000 Subject: [PATCH] formatting source-code for ca70c3097e51f7a3845cabf3a140d3a1fb2f3cb3 --- math/armstrong_number.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/math/armstrong_number.cpp b/math/armstrong_number.cpp index db8eb0fb7..426de327b 100644 --- a/math/armstrong_number.cpp +++ b/math/armstrong_number.cpp @@ -1,15 +1,17 @@ /** * @file - * \brief Program to check if a number is an [Armstrong/Narcissistic number](https://en.wikipedia.org/wiki/Narcissistic_number) in decimal system. - * + * \brief Program to check if a number is an [Armstrong/Narcissistic + * number](https://en.wikipedia.org/wiki/Narcissistic_number) in decimal system. + * * \details - * Armstrong number or [Narcissistic number](https://en.wikipedia.org/wiki/Narcissistic_number) - * is a number that is the sum of its own digits raised to the power of the number of digits. + * Armstrong number or [Narcissistic + * number](https://en.wikipedia.org/wiki/Narcissistic_number) is a number that + * is the sum of its own digits raised to the power of the number of digits. * @author iamnambiar -*/ + */ #include -#include #include +#include /** * Function to calculate the total number of digits in the number. @@ -42,7 +44,8 @@ bool is_armstrong(int number) { int total_digits = number_of_digits(number); while (temp > 0) { int rem = temp % 10; - // Finding each digit raised to the power total digit and add it to the total sum + // Finding each digit raised to the power total digit and add it to the + // total sum sum = sum + std::pow(rem, total_digits); temp = temp / 10; } @@ -50,7 +53,7 @@ bool is_armstrong(int number) { } /** - * Function for testing the is_armstrong() function + * Function for testing the is_armstrong() function * with all the test cases. */ void test() { @@ -70,7 +73,7 @@ void test() { /** * Main Function -*/ + */ int main() { test(); return 0;