Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit408a71a

Browse files
authored
Merge pull requestneetcode-gh#1651 from AkifhanIlgaz/0202
Create: 0202-happy-number.rs
2 parents2a02f32 +c1e4d09 commit408a71a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

‎rust/0202-happy-number.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
implSolution{
2+
pubfnis_happy(mutn:i32) ->bool{
3+
loop{
4+
letmut s =0;
5+
while n >0{
6+
s +=(n %10).pow(2);
7+
n /=10;
8+
}
9+
match s{
10+
1 |4 =>break s ==1,
11+
_ => n = s,
12+
}
13+
}
14+
}
15+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp