Задача 0092

Нехай v1 = v2 = 0; v3 = 1,5; v_i=\frac{i+1}{i^2+1}v_{i-1}-v_{i-2}v_{i-3} Дано натуральне n (n≥4). Отримати vi.

private static void Task92()
{
    double v1 = 0, v2 =0, v3 = 1.5,v=v3;
    int n = 4;
    n = Convert.ToInt32(Console.ReadLine());
    for (int i = 4; i < n; i++)
    {
        v = (i + 1.0)/(1.0 + i*i)*v3 - v2*v1;
        v1 = v2;
        v2 = v3;
        v3 = v;
    }
    Console.WriteLine(v);
}
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