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 want output as:

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

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
How to print this Format exactly?
How to print this Format exactly?   * * * & reverse
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:ADS_TO_REPLACE_1 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 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
ModuleNotFoundError: No module named 'print_array'
with following command: pip install print_array After the installation...ModuleNotFoundError: No module named 'print_array'  Hi, My Python... 'print_array' How to remove the ModuleNotFoundError: No module named '
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
Simplest way to print an array in Java
Simplest way to print an array in Java  Simplest way to print an array in Java
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
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
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 (adsbygoogle = window.adsbygoogle || []).push
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
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... Array example</h1><p><h2>Click to print the array element</h2
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 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...;); } Above lines of code will print all the elements of the array. Here
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 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
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
print  How to print JFrame All Componant?   Please visit the following link: http://www.roseindia.net/java/example/java/swing/Print.shtml
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
Print
into the stream and, as opposed to print() method, gets you to the new line after the text
print a form of *
print a form of *   * *** ***** ******* ********* ******* ***** *** *   Post the format properly
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
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
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
How to Add Array Item in PHP
Format int array_push(array &$array, mixed $var... to the array the values are follows: ";print_r($var);array_push($var,"... to the array the values are follows: ";print_r($var);echo" Another way to add
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:ADS_TO_REPLACE_1 import java.util.*; class
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)ADS... Sql Date and Time Format     
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
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
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..., then document. write print the undefined array on the browser. 
PHP Array Push Array
_TO_REPLACE_1 General Format int array_push(array &...;Elements of the first array is :</b><br/>"; print_r($array1... is :</b><br/>"; print_r($array2); array_push($array1,$array2
Array
Array  how can i use elements of an array in a circular form? that is if the searching of the element reach the last elements of the array, then it will start serching from the begining of the array
array
array  how to getting values and storing values in array by using datainputstream?   Hi Friend, Try the following code:ADS_TO_REPLACE_1...("Array Elements are: "); for(int i=0;i<arr.length;i
Array
Array  is it possible to define array like this..? int[] intArray = new int[] {4,5,6,7,8}; Explain...?   Yes, you can. Java Initialize Array
PHP Array Replace Recursive
following arrays. If a key is present in both first array and in the second...() is: ADS_TO_REPLACE_1 General Format array array_replace...PHP Array Replace Recursive: PHP provides array_replace_recursive() function
ModuleNotFoundError: No module named 'print_print'
with following command: pip install print_print After the installation...ModuleNotFoundError: No module named 'print_print'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named
array
array  write and test a function named mirror that is passed an array of n floats and returns a newly created array that contains those n floats... the array {10.1,11.2,8.3,7.5,22} into{22,7.5,8.3,11.2,10.1
array
array  write and test a function named mirror that is passed an array of n floats and returns a newly created array that contains those n floats... the array {10.1,11.2,8.3,7.5,22} into{22,7.5,8.3,11.2,10.1
array
array  write and test a function named mirror that is passed an array of n floats and returns a newly created array that contains those n floats... the array {10.1,11.2,8.3,7.5,22} into{22,7.5,8.3,11.2,10.1
Array
Array  How do i insert elements into an array up to a limit from...("Enter Range: "); int size=input.nextInt(); int array[]=new int[size]; System.out.println("Enter Array Elements: "); for(int i=0;i<

Ads