repeat
display dialog "Enter the coefficient A:" default answer "" buttons "Next" default button 1
set A to the text returned of the result as number
display dialog "Enter the coefficient B:" default answer "" buttons "Next" default button 1
set B to the text returned of the result as number
display dialog "Enter the coefficient C:" default answer "" buttons "Solve" default button 1
set C to the text returned of the result as number
set top1 to (B * B - 4 * A * C)
set top to top1 ^ (1 / 2)
set root1 to (-B + top) / (2 * A)
set root2 to (-B - top) / (2 * A)
display dialog "The solutions are: " & root1 & ", " & root2 & "" buttons {"Ok", "Do it Again"} default button 1
set theResult to the result as list
if theResult is equal to {"Ok"} then exit repeat
end repeat