Составить программу. Вычислить y=cos x+cos 2x+cos 3x+.+cos 30x - C#
Формулировка задачи:
Составить программу. Вычислить y=cos x+cos 2x+cos 3x+...+cos 30x
Решение задачи: «Составить программу. Вычислить y=cos x+cos 2x+cos 3x+.+cos 30x»
textual
Листинг программы
static void Main()
{
Console.Write("X = "); int x = Convert.ToInt32(Console.ReadLine());
double s = 0;
for (int i = 1; i <= 30; i++ )
{ s = s + Math.Cos(i * x); }
Console.Write("Сумма = "+s);
Console.ReadKey(true);
}