Wednesday, 26 August 2020

JSP PROGRAM TO FIND THE SQUARE OF THE GIVEN NO



SQUARE.JSP

<!DOCTYPE html>
<html>
<body>
<form method="post">
<h1>
Enter any number to find the square:
<input type="text" name="number"/><br><br>
</form>
<%@page import="java.io.*" %>
<%@page import="java.lang.*" %>
<%
String s="";
s=request.getParameter("number");
if (s!=null && !s.equals("")){
int n=Integer.parseInt(s);
int r=n*n;
out.println("Square of the given number is"+r);
}
else if(request.getMethod().equalsIgnoreCase("post")) {
out.println("Enter any number to find square !!!!!!");
}
%>
</h1>
</body>
</html>

OUTPUT:







No comments:

Post a Comment