GoConqr has a new look! Let us know what you think.

Notes

Maior valor

Gabriel Rocha JSP Portuguese 1 page

Content of the notes (1)

Page 1

Receber 3 valores e definir o maior

HTML

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>JSP Page</title>

</head>

<body>

<h1>Tabuada</h1>

<form action="tabuada.jsp">

Insira um número:<br>

<input type="text" name="num" placeholder="número">

<br> <br><br>

Insira um número:<br>

<input type="text" name="num2" placeholder="número">

<br> <br><br>

Insira um número:<br>

<input type="text" name="num3" placeholder="número">

<br> <br><br>

<input type="submit" value="Submit">

</body>

</html>

JSP

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>JSP Page</title>

</head>

<body>

<h1>Resultado</h1>

<%

String n1 = request.getParameter("num");

String n2 = request.getParameter("num2");

String n3 = request.getParameter("num3");

int n, nd, nt;

n = Integer.parseInt(n1);

nd = Integer.parseInt(n2);

nt = Integer.parseInt(n3);

%>

<%

if (n >= nd && n>=nt ){

out.println("o maior valor é " +n);

}

else if (nd>= n && nd >=nt) {

out.print("o maior valor é " +nd);

}

else {

out.print("o maior valor é " +nt);

}

%>

</body>

</html>

Information

Description
Receber 3 valores e definir qual é o maior
Created by
Gabriel Rocha · Aug 2017
Updated
Aug 29, 2017
Views
49
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?