Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace FunckjaKwa
- {
- class Math
- {
- public static void Kwadratowa(double a, double b, double c)
- {
- double delta = b * b - 4 * a * c;
- double x, x1, x2;
- if (delta > 0)
- {
- x1 = (-b + System.Math.Sqrt(delta)) / (2 * a);
- x2 = (-b - System.Math.Sqrt(delta)) / (2 * a);
- Console.WriteLine("Twoje x1 wynosi: " + x1);
- Console.WriteLine("Twoje x2 wynosi: " + x2);
- }
- else if (delta < 0)
- {
- Console.WriteLine("Twoja delta wynosi: " + delta + ". Brak rozwiązania");
- }
- else
- {
- x = (-b + System.Math.Sqrt(delta)) / (2 * a);
- Console.WriteLine("Twoje x wynosi: " +x);
- }
- }
- static void Main(string[] args)
- {
- double a, b, c;
- Console.WriteLine("Podaj liczby a, b i c funkcji kwadratowej");
- a = double.Parse(Console.ReadLine());
- b = double.Parse(Console.ReadLine());
- c = double.Parse(Console.ReadLine());
- Kwadratowa(a, b, c);
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement