Printing the integers before and after

Printing the integers before and after

View Answers

November 11, 2009 at 2:56 PM

Hi Friend,

Try the following code:

<%@ taglib uri="http://java.sun.com/jstl/core_rt"; prefix="c" %>
<%@ page import="java.util.*"%>
<% Random r=new Random();
int num = r.nextInt(10);
System.out.println(num);
int pno=num-1;
int nno=num+1;
%>
<html>
<body>

<c:set var="guess" value="<%=num%>"/>
<b>Random Numbers is </b>
<c:out value="${guess}"/>

<br/>
<c:if test="${(guess %2== 0)}">
<b>It is an even number lies between <%=pno%> and <%=nno%></b><br/>
</c:if>
<c:if test="${(guess %2!= 0)}">
<b>It is an odd number lies between <%=pno%> and <%=nno%>.</b><br/>
</c:if>

</body>
</html>

Thanks









Related Tutorials/Questions & Answers:
Printing the integers before and after - JSP-Servlet
Printing the integers before and after  Hi, I'm trying to print out the integers before and after generated random number, and also stating it as either even or odd, but it does not seem to work. Pls advise on my code below
ModuleNotFoundError: No module named 'before_after'
ModuleNotFoundError: No module named 'before_after'  Hi, My Python... 'before_after' How to remove the ModuleNotFoundError: No module named 'before_after' error? Thanks   Hi, In your python
Advertisements
there extra space before or after my table.
there extra space before or after my table.  Why is there extra space before or after my table
integers
integers  an application that finds the smallest of several integers. assume the first value read specifies the number of values to input from the user. please help
INTEGERS
application that will input the kms driven and litre of fuel used (both as integers
Updating variables in a loop? and only printing certain messages after the first iteration?!
Updating variables in a loop? and only printing certain messages after the first iteration?!  I've written a program that reads two values. I... and ratios. So effectively at every calculation except the first, I would be printing
Sum of integers
the user and displays i) the sum of all even integers between 1 and the input value, both inclusive. ii) The sum of all odd integers between 1 and the input value both inclusive Example: User enters 7. Sum of even integers = 2+4+6 = 12 Sum
integers
ModuleNotFoundError: No module named 'artisinal_integers'
After the installation of artisinal_integers python library...ModuleNotFoundError: No module named 'artisinal_integers'  Hi, My... named 'artisinal_integers' How to remove the ModuleNotFoundError: No module
ModuleNotFoundError: No module named 'artisinal_integers'
After the installation of artisinal_integers python library...ModuleNotFoundError: No module named 'artisinal_integers'  Hi, My... named 'artisinal_integers' How to remove the ModuleNotFoundError: No module
ModuleNotFoundError: No module named 'Printing'
command: pip install Printing After the installation of Printing python...ModuleNotFoundError: No module named 'Printing'  Hi, My Python... 'Printing' How to remove the ModuleNotFoundError: No module named 'Printing
printing in swing
printing in swing  How can i print payslip in swing
Create After Update Trigger in SQL
Create After Update Trigger in SQL       After Trigger in SQL is fired before update... The Tutorial illustrate an example from 'Create After Update Trigger in SQL
applet printing
applets gridwise and in each applet i am drawing some graph so while printing whole... but while printing it is not getting printed on paper and rest everything it is printing
Integers separated by a ", " in a string
Integers separated by a ", " in a string  How do I get integers separated by a ', ' in C++ in a string? Ex. string=1, 2, 3; //something to find the integers and put them in array a cout< output: 123   Hi Friend
printing in java
printing in java  hello i want to print a jInternalframe containing some lebels,but my printer sent me a paper with the following written on it: please what is the problem
Printing stars
Printing stars  I am a beginer and i have one assignment which couldnt give me any idea how to do it..The Question is "Get a string "001222014654" and print o/p as 0 - * 1- ** 2- * 4- ** 5-* 6-* I dont know how to split
Printing numbers up to N into a file
Printing numbers up to N into a file  I'd like to print the first N integers, that is, "1, 2, 3, 4, ..., N-1, N", say N equals 1000, or 10000 or whatever. I'd also like to have the result stored as a file instead of having
ModuleNotFoundError: No module named 'Printing-For-Noobs'
After the installation of Printing-For-Noobs python library...ModuleNotFoundError: No module named 'Printing-For-Noobs'  Hi, My... named 'Printing-For-Noobs' How to remove the ModuleNotFoundError: No module
ModuleNotFoundError: No module named 'colour-printing'
python with following command: pip install colour-printing After...ModuleNotFoundError: No module named 'colour-printing'  Hi, My... named 'colour-printing' How to remove the ModuleNotFoundError: No module named
how to find [count the number of integers whose value is less than the average value of the integers]
how to find [count the number of integers whose value is less than the average value of the integers]  Construct an algorithm that will prompt... of 999 is entered. After the sentinel has been entered, display the total payroll
Java program for printing document
Java program for printing document  can u send me the java program for printing the office document? email: [email protected]
printing java series
printing java series  * *** ***** ******** ***** *** *   Post the format properly
ModuleNotFoundError: No module named 'Printing-For-Coding-Python-Noobs'
with following command: pip install Printing-For-Coding-Python-Noobs After...ModuleNotFoundError: No module named 'Printing-For-Coding-Python-Noobs' ...: ModuleNotFoundError: No module named 'Printing-For-Coding-Python-Noobs' How to remove
ModuleNotFoundError: No module named 'Printing-For-Python-Coding-Noobs'
with following command: pip install Printing-For-Python-Coding-Noobs After...ModuleNotFoundError: No module named 'Printing-For-Python-Coding-Noobs' ...: ModuleNotFoundError: No module named 'Printing-For-Python-Coding-Noobs' How to remove
ModuleNotFoundError: No module named 'Printing-For-Coding-Noobs'
install Printing-For-Coding-Noobs After the installation of Printing...ModuleNotFoundError: No module named 'Printing-For-Coding-Noobs'  Hi...: No module named 'Printing-For-Coding-Noobs' How to remove
ModuleNotFoundError: No module named 'Printing-For-Python-Noobs'
install Printing-For-Python-Noobs After the installation of Printing...ModuleNotFoundError: No module named 'Printing-For-Python-Noobs'  Hi...: No module named 'Printing-For-Python-Noobs' How to remove
Printing server information
Printing server information  Hello, I am learning PHP language. I trying to fetch the server Information Print. How could i will printing the server... connected to your PC? This it best example for the Printing server Information
What is 3D Printing?
3D printing is one of those technologies that made manual job with the objects... used to know and interact with just a few decades before has changed beyond... and in the meantime we lose the erstwhile sense of solid sensory reality. 3D printing
printing example - Java Beginners
printing example  Is it possible to print java controls using print method? My problem is to print a student mark list using java? The mark list should like that of university mark list
Java Printing - Java Beginners
Java Printing  Can anybody plz help in giving the code for printing the contents of JPanel.. It contains JLabels and JTextFields only.. Plz.. Its urgetn.. Printing means sending the document to the Printer..  Hi Friend
Program to read 2 integers using oops concepts
Program to read 2 integers using oops concepts  Write a program to read two integers with the following significance. ? The first integer value... notation, in this case 1630 which is the time 3 hours and 45 minutes after 12.45.
Maven Repository/Dependency: com.almworks.integers | integers
Maven Repository/Dependency of Group ID com.almworks.integers and Artifact ID integers. Latest version of com.almworks.integers:integers dependencies. # Version Release Date 1
how printing landscape?
how printing landscape?  I have code which print some data from data base with "drawString()" and it works correct when I chose "Portrait" from "Print Dialog", but it does not work if chose "Landscape". Is any way to print
printing hollow square
printing hollow square  Write an application (PrintingSquares.java) that prompts the user to enter the size of the side of a square, then displays a hollow square of that size made of asterisks. Your program should work
printing press training course
printing press training course  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: printing... that I can learn the topic "printing press training course". Also tell
convertion before downloading
convertion before downloading  convert zip file which is in server to doc while before downloading
validate parameter before using it
validate parameter before using it   How to validate the parameter before using it in JSP
how to find the sum of integers in a string of sentence in java
how to find the sum of integers in a string of sentence in java  how to find the sum of integers in a string of sentence in java for e.g:--> abc d 2 3 21 the output should be 2+3+21=26 (adsbygoogle
Printing ArrayList - JSP-Servlet
Printing ArrayList   I have a code in servlet like this ArrayList total = new ArrayList (); session.setAttribute("efg",total); RequestDispatcher rd; rd = request.getRequestDispatcher("/checkout.jsp"); rd.forward
java matching array of integers - Java Beginners
token is assigned a vlaue in integers and stored in an array. the consecutive array of integers occurring similarly have to be found out. and depending upon... for finding similar consecutive array of integers
printing series in java
printing series in java  1 123 12345 1234567 12345 123 1   Here is a code for the following pattern: 1 123 12345 1234567 12345 123 1 class Pattern{ public static void main(String[] args
ModuleNotFoundError: No module named 'best-before'
with following command: pip install best-before After the installation of best...ModuleNotFoundError: No module named 'best-before'  Hi, My Python... 'best-before' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'best-before'
with following command: pip install best-before After the installation of best...ModuleNotFoundError: No module named 'best-before'  Hi, My Python... 'best-before' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'django-before'
with following command: pip install django-before After...ModuleNotFoundError: No module named 'django-before'  Hi, My... 'django-before' How to remove the ModuleNotFoundError: No module named
Printing 2 arrays
Printing 2 arrays  Hi, I have 2 arrays: String [] head = {"Name", "Date of birth", "PPS number"}; String [] personal= {value1, value2, value3}; I want this 2 arrays to be printed out in the following manner: head[0] tab
rename before uploading
rename before uploading  I need to change (rename)the file name/image name before uploading it so that the file gets uploaded on server with this new name
printing the following output using for loop
printing the following output using for loop  1 2 3 3 4 5 4 5 6 7
printing the following output using for loop
printing the following output using for loop  1 2 3 3 4 5 4 5 6 7
Maven dependency for com.almworks.integers - integers version 1.1.2 is released. Learn to use integers version 1.1.2 in Maven based Java projects
project. After adding the Maven dependency of com.almworks.integers - integers... of integers released The developers of   com.almworks.integers - integers..., the released version of  com.almworks.integers - integers library is 1.1.2.

Ads