طبعا زى ما كلنا عارفين ان الدكتور حمدى طلب مننا تكملة البرنامج
كان طالب فية بالتحديد ال Imaginary roots
اانا كنت عملت فيها شوية مجهود كدة ّ! والغريبه انها طلعت نواتج صحيحة :$%&: :$%&:
حبيت ارفعها لكم للى محتاجها وياريت اللى عندة فكرة تانية افضل واسهل يرفعها برضة
ملحوظة: البرنامج مجهود شخصى لم اسال احد من الدكاترة فالبرنامج ممكن يكون خطأ وبنسبة كبيرة #%%# #%%#


Dim a, b, c, d, x1, x2 As Double
Console.WriteLine(" This is a program to solve the quadratic equation ")
Console.WriteLine("input the coefficient of x^2")
Console.Write("a=")
a = Console.ReadLine()
Console.WriteLine("input the coefficient of x")
Console.Write("b=")
b = Console.ReadLine()
Console.WriteLine("input the free term")
Console.Write("c=")
c = Console.ReadLine()
d = b * b - 4 * a * c
If d > 0 Then
Console.WriteLine("the first root")
Console.Write("x1=")
x1 = (-b + Math.Sqrt(d)) / (2 * a)
Console.WriteLine(x1)
Console.WriteLine("the second root")
Console.Write("x2=")
x2 = (-b - Math.Sqrt(d)) / (2 * a)
Console.WriteLine(x2)
ElseIf d = 0 Then
Console.WriteLine("unique root")
Console.Write("x1=x2=")
x2 = -b / (2 * a)
Console.WriteLine(x2)

Else
Console.WriteLine("Imaginary roots")
x1 = (-b / 2 * a)
x2 = Math.Sqrt(-d) / (2 * a)
Console.WriteLine("the first root is ")
Console.WriteLine(x1 & " + i " & x2)
Console.WriteLine("the second root is ")
Console.WriteLine(x1 & " - i " & x2)
Console.WriteLine("i=(-1)^(1/2)")