11/* *
2- * @file
3- * @brief Program to check if a number is an [Armstrong/Narcissistic
4- * number](https://en.wikipedia.org/wiki/Narcissistic_number) in decimal system.
5- *
6- * @details
7- * Armstrong number or [Narcissistic
8- * number](https://en.wikipedia.org/wiki/Narcissistic_number) is a number that
9- * is the sum of its own digits raised to the power of the number of digits.
10- *
11- * let n be the narcissistic number,
12- * \f[F_b(n) = \sum_{i=0}^{k-1}d_{i}^{k}\f] for
13- * \f$ b > 1 F_b : \N \to \N \f$ where
14- * \f$ k = \lfloor log_b n\rfloor is the number of digits in the number in base \f$b\f$, and
15- * \f$ d_i = \frac{n mod b^{i+1} - n mod b^{i}}{b^{i}} \f$
16- *
17- * @author [Neeraj Cherkara](https://github.com/iamnambiar)
18- */
19- #include < cassert> // / for assert
20- #include < cmath> // / for std::pow
21- #include < iostream> // / for IO operations
2+ * @file
3+ * @brief Program to check if a number is an [Armstrong/Narcissistic
4+ * number](https://en.wikipedia.org/wiki/Narcissistic_number) in decimal system.
5+ *
6+ * @details
7+ * Armstrong number or [Narcissistic
8+ * number](https://en.wikipedia.org/wiki/Narcissistic_number) is a number that
9+ * is the sum of its own digits raised to the power of the number of digits.
10+ *
11+ * let n be the narcissistic number,
12+ * \f[F_b(n) = \sum_{i=0}^{k-1}d_{i}^{k}\f] for
13+ * \f$ b > 1 F_b : \N \to \N \f$ where
14+ * \f$ k = \lfloor log_b n\rfloor is the number of digits in the number in base
15+ * \f$b\f$, and \f$ d_i = \frac{n mod b^{i+1} - n mod b^{i}}{b^{i}} \f$
16+ *
17+ * @author [Neeraj Cherkara](https://github.com/iamnambiar)
18+ */
19+ #include < cassert> // / for assert
20+ #include < cmath> // / for std::pow
21+ #include < iostream> // / for IO operations
2222
2323/* *
2424 * @brief Function to calculate the total number of digits in the number.
@@ -61,9 +61,9 @@ bool is_armstrong(int number) {
6161}
6262
6363/* *
64- * @brief Self-test implementations
65- * @returns void
66- */
64+ * @brief Self-test implementations
65+ * @returns void
66+ */
6767static void test () {
6868 // is_armstrong(370) returns true.
6969 assert (is_armstrong (370 ) == true );
@@ -82,10 +82,10 @@ static void test() {
8282}
8383
8484/* *
85- * @brief Main Function
86- * @returns 0 on exit
87- */
85+ * @brief Main Function
86+ * @returns 0 on exit
87+ */
8888int main () {
89- test (); // run self-test implementations
89+ test (); // run self-test implementations
9090 return 0 ;
9191}
0 commit comments