AmidamaruZXC

Untitled

Feb 7th, 2020
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.84 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Task3452
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             // Считываем 4 числа
  14.             int a = int.Parse(Console.ReadLine());
  15.             int b = int.Parse(Console.ReadLine());
  16.             int c = int.Parse(Console.ReadLine());
  17.             int d = int.Parse(Console.ReadLine());
  18.             for (int x = 0; x <= 1000; x++) // Проверяем все числа от 0 до 1000 циклом
  19.                 if (a * x * x * x + b * x * x + c * x + d == 0) // Если уравнение равно 0, то выводим текущее значение цикла, то есть корень
  20.                     Console.WriteLine(x);
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment