Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
940 B
4
Indexable
Never
using System;
using System.Collections;
using System.Text;
using System.Text.RegularExpressions;

namespace ConsoleApp8
{
    class Program
    {

        static void Main(string[] args)
        {

            //bài 6
            Console.Write("nhap n: ");
            int n = Int32.Parse(Console.ReadLine());
            Console.Write("nhap x: ");
            double x = Double.Parse(Console.ReadLine());
            Console.WriteLine("nhap a: ");
            double[] a = new double[n];

            for (int i = 0; i < n; i++)
            {
                Console.Write("a" + i + ": ");
                a[i] = Double.Parse(Console.ReadLine());
            }
            double fx = 0;
            Console.Write("F(x) = ");
            for (int i = 0; i < n; i++)
            {
                fx += a[i] * Math.Pow(x, i);
            }
            Console.Write(fx);





        }


    }
}