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 ConsoleApplication12
- {
- class Program
- {
- static void Main(string[] args)
- {
- int a, b, c, delta, x;
- double pzd, x1, x2;
- Console.WriteLine("podaj a");
- a = int.Parse(Console.ReadLine());
- Console.WriteLine("podaj b");
- b = int.Parse(Console.ReadLine());
- Console.WriteLine("podaj c");
- c = int.Parse(Console.ReadLine());
- delta = b * b - 4 * a * c;
- pzd = Math.Sqrt(delta);
- Console.WriteLine("delta = {0}", delta);
- if(delta < 0)
- {
- Console.WriteLine("brak miejsc zerowych");
- }
- if(delta == 0)
- {
- x = -b / 2 * a;
- Console.WriteLine("jedno miejsce zerowe {0}", x);
- }
- if (delta > 0)
- {
- x1 = -b - pzd / 2 * a;
- x2 = -b + pzd / 2 * a;
- Console.WriteLine("dwa miejsca zerowe x1={0} x2={1}", x1, x2);
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement