Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Nauka_1
- {
- public class Program
- {
- public static void Main()
- {
- int A = 2, B = 3, C = -2;
- if (A == 0)
- {
- Console.WriteLine("Funkcja nie jest kwadratowa");
- }
- else
- {
- double delta = B * B - 4 * A * C;
- if (delta < 0)
- {
- Console.WriteLine("Delta jest mniejsza od 0, brak rozwiązań");
- }
- else
- {
- double wynik;
- if (delta == 0)
- {
- wynik = -B / (2 * A);
- }
- else
- {
- wynik = (-B - Math.Sqrt(delta)) / (2 * A);
- Console.WriteLine("x1 = " + wynik);
- wynik = (-B + Math.Sqrt(delta)) / (2 * A);
- Console.WriteLine("x2 = " + wynik);
- Console.ReadKey();
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement