mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-05-11 11:07:27 +08:00
Add cpplint to validate_filenames (#643)
* Add cpplint to validate_filenames * Update and rename Happy_number.cpp to happy_number.cpp * Update validate_new_filenames.yml * pip install cpplint * python3 -m pip install cpplint * python3 -m pip install --useer cpplint * python3 -m pip install --user cpplint * Update validate_new_filenames.yml * sudo python3 -m pip install cpplint * sudo python3 -m pip install cpplint * uses: actions/setup-python@v1 * Run cpplint first * cpp_exts * tuple * cpplint_modified_files
This commit is contained in:
@@ -1,19 +1,18 @@
|
||||
/* A happy number is a number whose sum of digits is calculated until the sum is a single digit,
|
||||
and this sum turns out to be 1 */
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
// Copyright 2019 TheAlgorithms contributors
|
||||
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
int n, k, s = 0, d;
|
||||
cout << "Enter a number:";
|
||||
cin >> n;
|
||||
std::cout << "Enter a number:";
|
||||
std::cin >> n;
|
||||
s = 0;
|
||||
k = n;
|
||||
while (k > 9)
|
||||
{
|
||||
while (k != 0)
|
||||
{
|
||||
while (k > 9) {
|
||||
while (k != 0) {
|
||||
d = k % 10;
|
||||
s += d;
|
||||
k /= 10;
|
||||
@@ -22,8 +21,8 @@ int main()
|
||||
s = 0;
|
||||
}
|
||||
if (k == 1)
|
||||
cout << n << " is a happy number" << endl;
|
||||
std::cout << n << " is a happy number" << std::endl;
|
||||
else
|
||||
cout << n << " is not a happy number" << endl;
|
||||
std::cout << n << " is not a happy number" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user