Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections.Generic;
- namespace FibonacciTest
- {
- public static class FibonacciGenerator
- {
- public static IEnumerable<int> Fibonacci()
- {
- int current = 1, next = 1;
- while (true)
- {
- yield return current;
- next = current + (current = next);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment