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

Given a positive integer num, return the sum of all odd Fibonacci numbers that are less than or equal to num.

NotificationsYou must be signed in to change notification settings

Nobledsmarts/Sum-All-Odd-Fibonacci-Numbers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Given a positive integer , return the sum of all odd Fibonacci numbers that are less than or equal to .numnum

The first two numbers in the Fibonacci sequence are 0 and 1. Every additional number in the sequence is the sum of the two previous numbers. The first seven numbers of the Fibonacci sequence are 0, 1, 1, 2, 3, 5 and 8.

For example, should return because all odd Fibonacci numbers less than or equal to are 1, 1, 3, and 5. sumFibs(10) 10 10

Tests

sumFibs(1) should return a number.

sumFibs(1000) should return 1785.

sumFibs(4000000) should return 4613732.

sumFibs(4) should return 5.

sumFibs(75024) should return 60696.

sumFibs(75025) should return 135721.


[8]ページ先頭

©2009-2025 Movatter.jp