Java code help

Java code help

Write a java program that will ask the user to input any number from 5 to 9 and then print the following structure depending on the user input. E.g. If the user input is 5, then print the following structure 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5

View Answers

April 5, 2013 at 3:13 PM

class Series {
         public static void main(String args[]) throws Exception {      

         BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

         System.out.println("enter number in between 5 to 9");
         Integer num=Integer.parseInt(br.readLine());

                for(int i=num;i>=1;i--) {
            for(int j=1;j<=i;j++)
            System.out.print(j+" ");
            System.out.print("  ");
        }

        for(int i=1;i<=num;i++)  {
            for(int j=1;j<=i;j++)
            System.out.print(j+" ");
            System.out.print("  ");
        }
        }

}









Related Tutorials/Questions & Answers:
help to write java code
help to write java code  write a full code to produce a system will calculate all items to get total carry-marks which are 60 marks. and get sum of assignment 1,assignment 2, midterms-test and lave work to get total marks
help to write java code
help to write java code  write a full code to produce a system will calculate all items to get total carry-marks which are 60 marks. and get sum of assignment 1,assignment 2, midterms-test and lave work to get total marks
Advertisements
Java Programming Code HELP
Java Programming Code HELP  Hi, sir/madam. I am new here and currently developing a program whereby it can read the Java source file...: String, attribute name = variable name) Below are my source code. Hope
Java code help
Java code help  Write a java program that will ask the user to input any number from 5 to 9 and then print the following structure depending on the user input. E.g. If the user input is 5, then print the following structure 1 2 3
Plz help me in writing the code - Java Beginners
Plz help me in writing the code   Write a two user Chess Game. (users must be on different systems
Plz help me in writing the code - Java Beginners
Plz help me in writing the code   Write a two user Chess Game. (users must be on different systems
Help on this java code for online library search
Help on this java code for online library search   I have written the following java code for simple library book search. but its having some errors ... please help me on this code. import java.sql.*; import java.awt.
please help me to give code - Java Beginners
please help me to give code  Write a program that prints an n-level stair case made of text. The user should choose the text character..., http://www.roseindia.net/java
Please help me to modify my java code from php code
Modify Java code from PHP Code  i want to covert this php code int java/JSP. if (isset($_POST['orders'])) { $orders = explode('&', $_POST... the exact result as the above PHP code is giving. So please help me to convert
please help me to give code - Java Beginners
please help me to give code  Write a program that reads a file named famous.txt and prints out the line with the longest length. In the case...(); } } } ------------------------------- read for more information, http://www.roseindia.net/java/beginners/read
please help me to give code - Java Beginners
please help me to give code  Write a function, sliding(word, num)that behaves as follows. It should print out each slice of the original word having length num, aligned vertically as shown below. A call to sliding(examples, 4
please help me to give code - Java Beginners
please help me to give code  Write a function with a signature cheerlead(word) that prints a typical cheer as follows. The word robot: Gimme an R Gimme an O Gimme a B Gimme an O Gimme a T What did you give me? ROBOT
please help me to give code - Java Beginners
please help me to give code  Write a program that uses loops to generate an n x n times table. The program should get n from the user. As a model here is a 4 x4 version: | 1 2 3 4
Please help me to modify my java code from php code
Please help me to modify my java code from php code  i want to covert this php code int java/JSP . if (isset($_POST['orders'])) { $orders... help me to convert it into Java. if (request.getParameter("orders") != null
Help in completing Servlet code!
Help in completing Servlet code!  Complete the following Servlet codes to store the information read from the input form to session object. public... String comment = req.getParameter(?commentText?); //Complete the code to store
Calender code ! HELP!!!
Calender code ! HELP!!!  how can i add 3 days to current date ? i am.... i am working on a school project & i really need help on this!!!ADS_TO_REPLACE_1 Please help me. This is my code: var Calendar = Class.create();ADS
Code Help Needed
Code Help Needed  I am trying to help a buddy of mine with this program and I can't seem to figure it out. I am still working on it but any help...[test]); line. Again thank you for any help. import java.util.*; import
Please help with this code
Please help with this code  I need some help getting the Search method below to work with the menu, and I also cannot figure out how to get my bubble sort to work. I've spent a long time on this and think my brain is just fried
more code help
more code help  Instructions: Write a program to translate a message from English to Morse code. Using a simple text editor like Windows Notepad, create a text file with all of the Morse code combinations for the letters
Pleae help me to give logic and code for this program - Java Beginners
Pleae help me to give logic and code for this program  Write a function that given the string ?original? create a new string ?dramatic? that has two...://www.roseindia.net/java/beginners/StringReverseUsingStringUtils.shtml
I need help on my Java code.... please please help me out!?
I need help on my Java code.... please please help me out!?  Well my code is supposed to ask for an input file and then (ex: input.txt), read... in the file. Also it should be displayed on the screen. However my code doesn't display
need someone to do/help with code
need someone to do/help with code  i need someone to do a code for me. It is a restaurant menu that displays a list of 10 food items. A customer..., along with the number of items sold..please help did a code 500 times cant
help in insert code - JSP-Servlet
help in insert code  I have some doubt in following code. I want to insert value using prepared statement.we r accessing connection from other package.can u plz help me out.  hiimport java.io.*;import java.sql.*;import
could anyone please help with the code.
could anyone please help with the code.  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException...(request, response); } } could anyone please check the code. If i enter
ajax code please help to solve this........
ajax code please help to solve this.  in this i am trying to get data... to database and retrieve viewbirthapplicants.jsp <%@ page language="java...;<a href="help.jsp">help instruction</a></li> <
What is the equivalent method in Java which is equivalent to clrscr() in c/c++ . The code should help to clear the output screen ?
What is the equivalent method in Java which is equivalent to clrscr() in c/c++ . The code should help to clear the output screen ?  Hello to all, I... here); But this doesn't worked for me, Can any one help to find answer
please help me to write a code for this program
please help me to write a code for this program   1 1 1 1 2 2 1 1 3 4 3 1 1 4 7 7 4 1
please help me to write a code for this program
please help me to write a code for this program   1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
Can any one please help me in this ,,,,,,, need java code for this ,,,,please anyone
Can any one please help me in this ,,,,,,, need java code for this ,,,,please anyone  The Airport Valet Parking Company (AVP) is a company which provides a convenient medium cost parking solution to users of a local airport. Key
PLZ HELP ME. i need php code.
PLZ HELP ME. i need php code.   I want php code for bellow OUTPUT. output is just example but it must be letters only. abc bcd efg jku rgt azs hje qqc wws adt
Not sure whats wrong with my code HELP PLEASE?!?!
Not sure whats wrong with my code HELP PLEASE?!?!  I cant figure out what I am doing wrong in my code can anyone help me out??? Grades ADS_TO_REPLACE_1 function computeGrade( ) { var hw, lab, midt, fin, avg; hw
java help!
java help!   I need help starting off a program I am trying to write for class. The class should contain a private instance variable to represent... start the code off for me? Thank You So Much
Please help me fix this code - MobileApplications
Please help me fix this code   Please help me in this area of code... in the background of the forms in this code i want to sum all expenses amount...); //*********************************************This code section is for List All Trip Expenses Screen
Can anybody help me with this simple MySql code
Can anybody help me with this simple MySql code  select c.countryid, r.bp, r.sp, c.country, t.timee from rate as r, countryloc as c, todaysrate as t... cad 2013-03-16 18:26:31 can any one help me with the query because i want
need help to remove and optimise the code for creating a page
need help to remove and optimise the code for creating a page   i have the following code but it has some sorts of error whenever i run the page after validation through javascript it calls for the servlets and then i tried
Help With Java...
Help With Java...  Write a java program that can take a positive integer greater than 2 as input and write out the number of times one must repeatedly divide this number by 2 before getting a value less than 2
i want to find the byte code of a image file ... for my project..plz if anybody help me for java coding i will grateful..
i want to find the byte code of a image file ... for my project..plz if anybody help me for java coding i will grateful..   i want to convert a image file to its byte code format that help me for the pattern matching in my
java help?
java help?  Write a program, where you first ask values to an array with 6 integer values and then count the sum and average of the values in methods... out results in the main program   Hi Friend, Try the following code
help in java
help in java   Rational Numbers Rational numbers are numbers that can be represented as a fraction p / q where p is an integer number and q is a positive integer (q != 0). Design and implement a Java class RationalNumber
help for java
help for java  1.convert the following Pseudo code to java if/else structure if student?s grade is greater than or equal to 90 Print... ?F?  Here is a code that accepts the number of students
help in java
help in java  Write an application that prompt the user to enter a number to use as an array size, and then attempt to declare an array using the entered size. Java generates a NegativeArraySizeException if wou attempt to create
java help
java help   Write a Java program that does the following: 1.Creates a grading program based on the Baker College grading standard. You will need to look up the current grade standard. You may use only the letter grades without
help in java
help in java  3.Flights Design and implement a class called Flight that represents an airline flight. It should contain instance data that represents the airline name, flight number, and the flight's origin and destination cities
help in java
help in java  Write a program that will evaluate simple expressions such as 17 + 3 and 3.14159 * 4.7. The expressions are to be typed in by the user. The input always consist of a number, followed by an operator, followed
java help
java help  How to Open CSV Files in a Microsoft Excel Application Using Java Code with example pgm
help in java
help in java  Design and implement a class called Sphere that contains instance data that represents the sphere's diameter. Define the Sphere constructor to accept and initialize the diameter, and include getter and setter
help in java
help in java  The factorial of a nonnegative integer n is written n! (pronounced ââ?¬Å? n factorialââ?¬Â?) and is defined as follows: n!=n . (n-1) . (n-2) . .... . 1 (for values of n greater than or equal to 1) and n!=1 (for n
help in java
help in java  Gross And Dozens Design and implement a class called GrossAndDozens to convert a given number of eggs into the number of gross, the number of dozens, and to the number of left over eggs. If you have N eggs, then you
help in java
help in java  Shopping cart Create 3 shopping carts from a Cart class. Each class should have four items in it, a title, a price for the 4 items and the number of each. Your shopping cart should use private variables, so use
help in java
help in java   Team Roster Create a program called TeamRoster that uses a class called Roster. Roster should contain a team name and the names of all... or help me on this pleas.. 7. Gross And Dozens Design and implement a class

Ads