<%--
Document : pag2
Created on : 12-nov-2013, 5:34:33
Author : Laboratorio 2
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body bgcolor="green" text="white">
<%! String a,b,c;
double result1 ,result2;
%>
<%
a = (String)request.getParameter("T1");
b = (String)request.getParameter("T2");
c = (String)request.getParameter("T3");
%>
<!--Imprimir -->
<center>
<%
if(request.getParameter("T1").equals("") && request.getParameter("T2").equals("") && request.getParameter("").equals("") )
{
out.println("ERROROROROROR" );
}
else{
int a1 =Integer.parseInt(a);
int b1 = Integer.parseInt(b);
int c1 =Integer.parseInt(c);
int raiz = (b1 * b1) - (4 * a1 * c1);
result1 = (-b1 + Math.sqrt(raiz)) / (2 * a1);
result2 = (-b1 - Math.sqrt(raiz)) / (2 * a1);
out.println("</br></br></br></br><h3>Resultado es:</h3></br>" + "X1: "+result1+"</br>"+"X2: "+ result2 );
}
%>
</body>
</html>
IMAGEN:
No hay comentarios:
Publicar un comentario