Home Answers Viewqa Java-Beginners print array in following format

 
 


Abhishek Sharma
print array in following format
1 Answer(s)      8 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

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 Pages:
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
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
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
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 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
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
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>
txt to cvs format
file from one directory and writes an new one in cvs format in another one. I am running into a problem on how to correctly format it . for now this is what i have... Thread{ /*the following are my inpath which is the dir to the files to be read
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
print a form of *
print a form of *   * *** ***** ******* ********* ******* ***** *** *   Post the format properly
Array copy
to print out the new array with the random numbers and index numbers as well ? best...Array copy  Hello all. could someone telle me how to copy an array (holding random numbers) to a new array...( then make randomnumbers
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
PHP Array Push Array
: General Format int array_push(array &$array, mixed...;; print_r($array1); $array2=array("n","e","w"... is :</b><br/>"; print_r($array2); array_push($array1,$array2
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
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
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
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
; 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 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
Display String in Circular Format in Java
Display String in Circular Format in Java In this section, you will learn how... 'WORD'. Now we have to shift each character of the string in the circular format. So we have created following method that will shift each character to left
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
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
Array  Write a program to store the population of 8 countries. i) Define two arrays to store the names of the countries and their populationââ?¬â?¢s numbers. ii) Write a loop that uses these arrays to print each countryââ?¬â?¢s
program in array
program in array  print("code sample");write a program that initializes an array with ten random integers and then prints four lines of output... the following code: import java.util.*; class ArrayExample2{ public static void main
Array
the following alternatives: Please type 1 for Twin Seat and Please type 2 for Normal... reserved. Use a one-dimensional array of primitive type Boolean to represent the seating chart of the cinema theater. Initialize all the elements of the array
PHP Associative Array
']="Safari"; $array['nano']=2009; print_r($array); ?>...['suv']="Safari"; $array['nano']=2009; print_r($array); ?>...: General Format array each(array $array
Array List
?¬â?¢ information using the following format // // HOUSE IN TAMAN... ArrayList. Display the housesââ?¬â?¢ information using the following format...Array List   Complete the class House and HouseApp below to display
Array List
the housesâ?? information using the following format // // HOUSE IN TAMAN... the housesâ?? information using the following format: // HOUSE IN TAMAN ILMU LESS...Array List  Could somebody help me to solve this question. I am glad
Printing numbers in pyramid format - Java Beginners
Printing numbers in pyramid format  Q) Can you please tel me the code to print the numbers in the following format: 1... the following code: public class Pyramid{ public static void main (String
time format
time format  How to seperate time from following DateFormat dateFormat = new SimpleDateFormat("yyyy-dd-mm HH:mm:ss.S
Java display file content in hexadecimal format
the file contents byte by byte and print the value in hexadecimal format...Java display file content in hexadecimal format In this section, you will learn how to read the file content and display it in hexadecimal format. Reading
JavaScript array for loop
JavaScript array for loop       In this Tutorial we want to understand you how an array for loop is executed in a JavaScript. The code import the following packages- 1
PHP Array
_array[3] = "Pear"; To print the value of stored at index 3  you can use following code: <? echo $fruit_array[2] ?> Following code shows how..., 5,6,7,8); You can also create using following code: $a = array(1 => '
Program to implement array of Objects.
for the name in the array of objects , if it is existing print the information...Program to implement array of Objects.  Create a class it has following data members:- -name -account id -balance initialize the data members through
nmber printed in pyramid format
nmber printed in pyramid format  how to print this format using java 1 23 345 4567 56789
PHP Array Replace Recursive
following arrays. If a key is present in both first array and in the second...() is:  General Format array array_replace_recursive(array...PHP Array Replace Recursive: PHP provides array_replace_recursive() function
write following program
write following program  Q1 What is the difference between single threaded application and multithreaded application? What are the benefits of multi... a no. If a no is even then print it else throw a user defined exception Q5 Draw
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
array in javascript - Java Beginners
array in javascript  how to initialize array in javascript and can we increase the size of array later on? is Array class in javascript ? also... format then how to parse or cast it into integer so that it can be used
Reading binary file into byte array in Java
= new String(bytes); //Print the byte data into string format...Example code of reading binary file into byte array in Java This example shows you how to read a binary file into byte array from Java program. This type
DateInterval::format
) Parameters of DateInterval::format format The following characters are recognized...DateInterval class in PHP DateInterval::format function is used for formatting the interval. It returns the format interval.  Description on PHP
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);?>

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.