]]> ]]>

Квадратное уравнение в Euphoria

Пример для версий Euphoria 3.1.1
include get.e

atom A
atom B, C
atom D

A = prompt_number("A=", {})
if A = 0 then
    puts(1,"Not a quadratic equation.\n")
else
    B = prompt_number("B=", {})
    C = prompt_number("C=", {})
    D = B*B - 4*A*C
    if D = 0 then
        printf(1,"x = %g\n", -B/2/A)
    else
        if D > 0 then
            printf(1,"x1 = %g\n", -B+sqrt(D)/2/A)
            printf(1,"x2 = %g\n", -B-sqrt(D)/2/A)
        else
            printf(1,"x1 = (%g,%g)\n", {-B/2/A, sqrt(-D)/2/A})
            printf(1,"x2 = (%g,%g)\n", {-B/2/A, sqrt(-D)/2/A})
        end if
    end if
end if

Комментарии

]]>

blog comments powered by Disqus

]]>

Работа программистам