Skip to content

Commit 38f457a

Browse files
committed
Find Perfect Number - MICROSOFT
1 parent f99f271 commit 38f457a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Solution/Day-070.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution{
2+
public:
3+
int getNextPerfectNumber(int n){
4+
auto temp_sum = 0;
5+
auto temp = n;
6+
while(n){
7+
temp_sum += (n%10);
8+
n /= 10;
9+
}
10+
return temp*10+(10 - temp_sum);
11+
}
12+
};

0 commit comments

Comments
 (0)