Write a JAVA JSP Program to print 10 even and 10 odd numbers.
Posted by MohammadYusuf
Last Updated: October 28, 2016
  14427

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>Printing 10 Even and Odd numbers</title>
</head>
<body>
<%
out.print("<b>First 10 Even numbers are</><br>");
for( int i=1;i<=20;i++)
{
    if(i%2==0)
{
    out.print("<br><b>"+i+"</b>");
}
}
out.print("<br><br><b> First 10 odd numbers are</b><br>");
for( int i=1;i<=20;i++)
{
    if(i%2!=0)
{
    out.print("<br><b>"+i+"</b>");
}
}
%>
</body>
</html>