Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners print array in following format

Have Programming Question? Ask it here!
 
 
 


Abhishek Sharma
print array in following format
1 Answer(s)      a year and 10 months ago
Posted in : Java Beginners


i want print two array in following format first array= 1,2,3,4,5,6,7,8,9 second array=11,12,13,14,15,16,17,18,19

i want output as:

1 2 3 11 12 13 4 5 6 14 15 16 7 8 9 17 18 19


Advertisement
View Answers

September 14, 2012 at 4:55 PM


Here is a code that displays the array values in the following pattern:

1 2 3  11 12 13
4 5 6  14 15 16
7 8 9  17 18 19

class DisplayArray 
{
    public static void main(String[] args) 
    {
        int array1[]= {1,2,3,4,5,6,7,8,9};
        int array2[]={11,12,13,14,15,16,17,18,19};

        int rows = 3;
        int columns = 3;
        for (int row = 0; row < rows; row++) {
        for (int column = 0; column < columns; column++) {
            System.out.print(array1[row * columns + column]+" ");
        }
        System.out.print("  ");
         for (int column = 0; column < columns; column++) {
            System.out.print(array2[row * columns + column]+" ");
        }
         System.out.println();
        }
    }
}


Related Tutorials/Questions & Answers:
print array in following format
print array in following format  i want print two array in following format first array= 1,2,3,4,5,6,7,8,9 second array=11,12,13,14,15,16,17,18,19 i...; Here is a code that displays the array values in the following pattern: 1 2
Print the following format
Print the following format  how to print the following format given string "00401121" in java 0-** 1-* 2-* 3- 4
Advertisements
C program to print the following
C program to print the following  Hello, Some one help me with a "C Program" to print the following as output: 4444444 4333334 4322234 4321234 4322234 4333334 4444444 // for input 4. And also
print the following series
print the following series  a b c d e b c d e c d e d e e   Hi Friend, Try the following code: class StringPattern { public static void main(String[] args) { String st="abcde
how to print the following pattern
how to print the following pattern  Hello hEllo heLlo helLo hellO pls reply soon its an emergency   class StringPattern { public static void main(String[] args) { String st="hello
How to print this Format exactly?
How to print this Format exactly?   * * * & reverse
how to print pdf format
how to print pdf format  Hi every body iam doing school project iam using backend as oracle front end java .how to print student marks list /attendence in pdf format. please help me. thanks in advance.   Here
How to print the following pattern in java?
How to print the following pattern in java?  How to print the following pattern in java? he he is he is going he is going in   import java.io.*; class StringPattern { public static void main(String[] args
write a program in C to print following triangles on the screen
write a program in C to print following triangles on the screen  write a program in C to print following triangles on the screen
i want print the following out put
i want print the following out put  Hello sir i want the following out put can u provide the program in c# o/p; HELLOLLEH HELLLEH HELEH HEH H
C Program to Print Following Output - Development process
C Program to Print Following Output  Hello Sir I wnat to print Followning output in C Language with for loop How I Can Print it? 5 5 4 5 4 3 5 4 3 2 5 4 3 2 1  Hi Friend, Try the following: #include
How to print the following output using c program
How to print the following output using c program  1) 4 3 4 2 3 4 1 2 3 4 2) A B C D E F G H I J
Simplest way to print an array in Java
Simplest way to print an array in Java  Simplest way to print an array in Java
how to create an xml file in following clear format
how to create an xml file in following clear format  anyone please help me out to create this file,,. <Tasks> <Taskid>1 <Taskname>Coding <Project>CeMIC <Date>
How to Print Array in JavaScript
How to Print Array in JavaScript In this section you will learn about Array in JavaScript. Array are important part of all programming languages. Array...;<h2>Click to print the array element</h2></p><p><input
how to check and print the no of times an integer is repeated in an array
how to check and print the no of times an integer is repeated in an array  how to check and print the no of times an integer is repeated in an array??? suppose my input is 2 4 2 5 2 4 3 4 5 2 then my output should be 2-4
JavaScript array print
JavaScript array print     ... print them wherever we wish. Here is the simple example of array printing which... have used a for loop to print all the elements of the array. for(var i
print
print  How to print JFrame All Componant?   Please visit the following link: http://www.roseindia.net/java/example/java/swing/Print.shtml
how i can print the elements before a spicific value in array queue?
how i can print the elements before a spicific value in array queue?  how i can printall elements befor the spicific value and print this value also   Hi Friend, Try this: <html> <script> var arr=new Array
print selected checkbox names in array without form tag
print selected checkbox names in array without form tag  Hi everyone ... I have problem in my program. I have hashmap i.e. collection , my code is as follows [code] <%! private HashMap<Integer, Domain>domainmap
i need to print customer[1] is abcd,cbnb using array
i need to print customer[1] is abcd,cbnb using array  print("code sample"); package bankprj3; class Account { private double Balance; public Account(double initBalance){ Balance=initBalance; } public
i need to print customer[1] is abcd,cbnb using array
i need to print customer[1] is abcd,cbnb using array  print("code sample"); package bankprj3; class Account { private double Balance; public Account(double initBalance){ Balance=initBalance; } public
i need to print customer[1] is abcd,cbnb using array
i need to print customer[1] is abcd,cbnb using array  print("code sample"); package bankprj3; class Account { private double Balance; public Account(double initBalance){ Balance=initBalance; } public
i need to print customer[1] is abcd,cbnb using array
i need to print customer[1] is abcd,cbnb using array  print("code sample"); package bankprj3; class Account { private double Balance; public Account(double initBalance){ Balance=initBalance; } public
Print
into the stream and, as opposed to print() method, gets you to the new line after the text
I want to know the all possible syntax for EL code to print the first element of an array.
I want to know the all possible syntax for EL code to print the first element of an array.  Which is the correct EL codes syntax to print the first element of an array named employeeArray. ${employeeArray["0"]} or ${employeeArray
Simple Date Format Example
Following is a simple date format example made using Format class. We have uses a pattern of special characters to date and time format. In this example, SimpleDateFormat:class is used to format date into text and parse text into date
print a form of *
print a form of *   * *** ***** ******* ********* ******* ***** *** *   Post the format properly
Sql Date and Time Format
Format'. To understand this example we use the following syntax that  is used to  format date and time.  SYNTAX:- DATE_FORMAT(date,format... Sql Date and Time Format     
how to print the average of each column of 2d n*m array using java
how to print the average of each column of 2d n*m array using java  here is my code: import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public
array
will print only the designated portion of the array. Validate low and high; if either...array  Consider the following code below. The function printArray accepts a pointer to integer which represents an array of integer.After
JavaScript Array
; JavaScript array print In the JavaScript array... and we will print them.    JavaScript array push... is a condition that occurred when a user want to print an array element more
print the newline
print the newline  Why doesn?t the following code print the newline properly? <?php $str = ?Hello, there.\nHow are you?\nThanks for visiting.?; print $str; ?>   Hi friends, Inside the single quotes \n (newline
print the sequence
print the sequence  how can I write the code by using for loop to produce this following statement: 10,9,8,7,6,5,4,3,2,1,buzz! please, help me
date print
date print  how can i print the date in jsp page in the following formate month-date-year. (example. march 8 2012
date print
date print  how can i print the date in jsp page in the following formate month-date-year. (example. march 8 2012
do the following
do the following  write a program to enter the string and do the following 1- count totle number of vowel 2- replace vowel 3- delete the charactor from given value 4- riverce the string 5- convert second word in upercase 6
Array
Array  What if i will not declare the limit index of an array, how will I declare an array and store values with it using loop?   Hi Friend, Try the following code: import java.util.*; class ArrayExample2
JavaScript Array undefined
to print an array element more than the declared size of element that an array... the script till variable i is less than array length. The document. write print... print the undefined array on the browser.  JavaScriptArrayUndefined.html
array
array  How to store the results of mysql query in an array and display the result in web page.? for exemple I need to store the result of following qurey in array: "select distinct(EMPLID)from tblwork where EMPLID not in (select
How to Add Array Item in PHP
: ";print_r($var);array_push($var,"Chennai", "...: ";print_r($var);echo" Another way to add item into an array... into an array is as follows:";$var[]="Jamshedpur";print_r($var);?>
date_parse_from_format
about given date. Description on PHP Date Parse Format array date_parse_from...:00"; print_r(date_parse_from_format("j.n.Y H:iP", $date...  date_parse_from_format date_parse_from_format function returns
in_array
in_array  in_array in php
is _array()
is _array()  is_array() in php   Hi Friend, This function is of Boolean type.It checks whether a variable is an array or not. Here is an example: <?php $yes = array('Hello', 'World'); echo is_array($yes) ? 'Array
is _array()
is _array()  is _array()   Hi Friend, This function is of Boolean type.It checks whether a variable is an array or not. Here is an example: <?php $yes = array('Hello', 'World'); echo is_array($yes) ? 'Array
print initials
print initials  How to print initials of a name without using arrays?   Hi Friend, You can try the following code: import java.util.*; public class InitialName { public static void main(String[] args
array
array  how to getting values and storing values in array by using datainputstream?   Hi Friend, Try the following code: import java.io....]=Integer.parseInt(br.readLine()); } System.out.println("Array Elements
nmber printed in pyramid format
nmber printed in pyramid format  how to print this format using java 1 23 345 4567 56789
To print initials
To print initials  import java.util.Scanner; class initials { String a ; int e ; char f ; int b ; int c ; char d; Scanner sc = new... is wrong in it ????   Please go through the following
Array in java
Array in java In following example we will discuss about Array in Java. Array..., Boolean, String object. We can store only primitive data in array. We have... in memory at fixed size. We can use multiple type array. It can be used in Java, C
Advertisements
 

 

 

DMCA.com