formatting source-code for ca70c3097e

This commit is contained in:
github-actions 2020-06-25 09:51:24 +00:00
parent ca70c3097e
commit 351a1b712a

View File

@ -1,15 +1,17 @@
/** /**
* @file * @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 * \details
* Armstrong number or [Narcissistic number](https://en.wikipedia.org/wiki/Narcissistic_number) * Armstrong number or [Narcissistic
* is a number that is the sum of its own digits raised to the power of the number of digits. * 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 * @author iamnambiar
*/ */
#include <cassert> #include <cassert>
#include <iostream>
#include <cmath> #include <cmath>
#include <iostream>
/** /**
* Function to calculate the total number of digits in the number. * 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); int total_digits = number_of_digits(number);
while (temp > 0) { while (temp > 0) {
int rem = temp % 10; 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); sum = sum + std::pow(rem, total_digits);
temp = temp / 10; temp = temp / 10;
} }
@ -70,7 +73,7 @@ void test() {
/** /**
* Main Function * Main Function
*/ */
int main() { int main() {
test(); test();
return 0; return 0;