Printing the integers before and after 1 Answer(s) 3 years and 6 months ago
Posted in : JSP-Servlet
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 Pages:
Printing the integers before and after - JSP-Servlet Printing the integersbefore and after Hi,
I'm trying to print out the integersbefore 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
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
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.
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
settings in control panel before jdbc
settings in control panel before jdbc do we need to do any settings in the control panel before starting jdbc?
Hello Friend... the driver Microsoft Access Driver(*.mdb).
3)After selecting the driver, click finish
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
Create After Update Trigger in SQL
Create After Update Trigger in SQL
After Trigger in SQL is fired before update... illustrate an example from 'Create After Update Trigger in
SQL'. In order
Integers
Java NotesIntegers
Integers are whole numbers, for example, -35, 0, 2048, ....
Integers are represented in binary inside the computer, and in
decimal... of primtive integers and two integer classes.
Primitive types. The are four types
printing in swing printing in swing How can i print payslip in swing
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
Create After Update Trigger in SQL
Create After Update Trigger in SQL
After Trigger in SQL is fired before update... illustrate an example from 'Create After Update Trigger in
SQL'. In order
Date Comparison
, whether they are equal or not, the first date comes before the other or
not, the first date comes after the other or not, by using
the equals(), before() and after() methods of the date class.
Description of program:  
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
Error after restart server... - XML
Error after restart server... Hi,
Im using Oracle JDeveloper 10g... the entire server..
then after they restart, my application cannot run.its like that my app cannot link.connet to the database...before the server restart my
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:
"www.java2s.com"
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
change the name of the image after uploading the image
change the name of the image after uploading the image my form consists of a textbox and uploading the image.after uploading the image i want to change the name of the image with the content of the textbox before saving
Comparing two Dates in Java with the use of before method
Comparing two Dates in Java with the use of before method... of comparing dates you have
seen how to use after() method in java class for comparing... with the use of
java.util.Date class. For comparing date we are using before() method
Example - Calc Extensions
Java: Example - Calc Extensions
Example - Calc Main,
Example - Calc GUI,
Example - Calc Extensions
Programming exercises.
Check for zero before....
The calculator example program
(See Example - Calc Main)
uses integers
Java program for printing document
Java program for printing document can u send me the java program for printing the office document?
email: ibrahimbest@gmail.com
printing java series printing java series *
***
*****
********
*****
***
*
Post the format properly
Spring AOP After Returning advice
.style1 {
background-color: #FFFFCC;
}
Spring AOP After Returning Advice Example
In this tutorial you will learn how to invoke method after advice This advice
is executed when program exits the joinpoints
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
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
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
Mangling Integers,java,java newsletter,tutorial
Mangling Integers
2005-01-31 The Java Specialists' Newsletter [Issue 102] - Mangling Integers
Author:
Dr. Heinz M. KabutzJDK version: Sun JDK 1.5.0_01... and
welcoming.
Mangling Integers
When I was a kid, I enjoyed
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 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
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
Hibernate hello world
In this section, you will learn about basic tutorial of inserting value in the database table and printing "hello world" on the console after successful insertion
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
convertion before downloading
convertion before downloading convert zip file which is in server to doc while before downloading
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 Session Id Using Variable Printing Session Id Using Variable Hi,
I am a learner in PHP language. Could any one guide me, how to print session Id using variable in PHP.
Thanks