Задача 0091

91. Нехай а0 = 1; ak = k ak-1 + 1/k, k = 1, 2, … Дано натуральне число n. Одержати an.

using System;
namespace ConsoleApplication1
{
    /// <summary>
    ///  91. Нехай а0 = 1; ak = ka[k-1] + 1/k, k = 1, 2, …
    ///  Дано натуральне число n. Одержати an.
    /// <summary>
    class Program
    {
        static void Main()
        {
            const int number = 10;
            double a = 0;
            for (var i = 1; i &lt; number; i++)
            {
                var b = i*a + 1.0/i;
                a = b;
                Console.WriteLine(a);
            }
        }
    }
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s