3
unknown
plain_text
3 years ago
788 B
6
Indexable
using System;
namespace FibonacciSum
{
class Program
{
static long Fibonacci(long n)
{
if (n <= 1)
{
return n;
}
else
{
return Fibonacci(n - 1) + Fibonacci(n - 2);
}
}
static void Main(string[] args)
{
long n = 10; // Calculate the 10th term in the Fibonacci sequence
long y = 4000000000; // Sum up to 4,000,000,000
long fibonacci = Fibonacci(n);
Console.WriteLine("The " + n + "th term in the Fibonacci sequence is " + fibonacci);
long sum = Fibonacci(y / 3) * 2 + Fibonacci(y / 2);
Console.WriteLine("Sum of all even numbers in the
Editor is loading...