Função quadrática
Publicado por Thiago 17/05/2005
[ Hits: 15.610 ]
Galera se tiver algum erro me notifiquem!
E viva o linux!!!
<HTML>
<HEAD>
<TITLE>FUNÇÃO DO 2º GRAU</TITLE>
</HEAD>
<BODY>
<MARQUEE><FONT COLOR=BLUE SIZE=10><B>FUNÇÃO DO 2º GRAU</B></FONT></MARQUEE>
<SCRIPT LANGUAGE="JavaScript1.3">
<!--
window.alert("==================..FUNÇÃO DO 2º GRAU..===================");
A = window.prompt("INFORME O VALOR DO COEFICIENTE (A) ","");
B = window.prompt("INFORME O VALOR DO COEFICIENTE (B) ","");
C = window.prompt("INFORME O VALOR DO COEFICIENTE (C) ","");
if((A == "") || (A == " "))
{
A = 0;
}
else if((B == "") || (B == " "))
{
B = 0;
}
else if ((C == "") || (C == " "))
{
C = 0;
}
document.write("<P>" + "FÓRMULA DA FUNÇÃO DO 2° GRAU: ax² + bx + c" + "</P>");
document.write("<P>" + "FÓRMULA DE BÁSKARA OU DELTA : b² -4 * a * c" + "</P>");
delta = ( (B * B) -(4 * (A) * (C)));
raiz = Math.sqrt(delta,2);
x1 = (-B - raiz / (2 * A));
x2 = (-B + raiz / (2 * A));
document.write("<P>" + "VALOR DE A = " + A + "</P>");
document.write("<P>" + "VALOR DE B = " + B + "</P>");
document.write("<P>" + "VALOR DE C = " + C + "</P>");
document.write("<P>" + "VALOR DE DELTA = " + delta + "</P>");
document.write("<P>" + "RAIZ DE DELTA = " + Math.round(raiz) + "</P>");
document.write("<P>" + "VALOR DE X LINHA = " + Math.round(x1) + "</P>");
document.write("<P>" + "VALOR DE X DUAS LINHAS = " + Math.round(x2) + "</P>");
if(delta < 0)
{
document.write("<P>" + "RAÍZES REAIS IMAGINÁRIAS." + "</P>");
}
else if(delta == 0)
{
document.write("<P>" + "RAIZ COMUM." + "</P>");
}
else
{
document.write("<P>" + " ============> RAÍZES REAIS DIFERENTES." + "</P>");
}
reset = window.prompt("DESEJA REINICIAR O PROGRAMA ? " + '\n' + "INFORME S.","");
if(reset == "S")
{
window.location.reload();
}
// -->
</SCRIPT>
</BODY>
</HTML>
283 Script Úteis em JavaScript para um amplo estudo!
Cirurgia para acelerar o openSUSE em HD externo via USB
Void Server como Domain Control
Modo Simples de Baixar e Usar o bash-completion
Monitorando o Preço do Bitcoin ou sua Cripto Favorita em Tempo Real com um Widget Flutuante
Como fazer a conversão binária e aplicar as restrições no Linux
Como quebrar a senha de um servidor Linux Debian
Como bloquear pendrive em uma rede Linux
Um autoinstall.yaml para Ubuntu com foco em quem vai fazer máquina virtual
Instalar GRUB sem archinstall no Arch Linux em UEFI Problemático









