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




Have Programming Question? Ask it here!
 
 
 


denzel denis
2d arrays
1 Answer(s)      3 years and a month ago
Posted in : Java Beginners


what is the code for multiplying the values in a 2d array and printing out their sum


Advertisement
View Answers

July 8, 2011 at 1:14 PM


public class MultiplicationTable{
public static void main(String[] args){
    int sum=0;
int[][] array = new int[11][11];
for(int i=1; i<array.length; i++) {
for(int j=1; j<array[i].length; j++){
array[i][j] = i*j;
sum+=array[i][j];
System.out.print(" " + array[i][j]);
}
System.out.println("");
}
System.out.println(sum);
}
}


Related Tutorials/Questions & Answers:
2d arrays
2d arrays  what is the code for multiplying the values in a 2d array and printing out their sum
java 2d arrays
java 2d arrays  Create a program that will: a) Create the array and populate it with the given values. 9, 8 2, 17 49, 4 13, 119 2, 19 11, 47.... and if i do it manualy it is wrong. public class Arrays { public static void main
Advertisements
Concatenate 2D arrays
Concatenate 2D arrays  JFileChooser jf = new JFileChooser(); jf.setMultiSelectionEnabled(true); int returnVal = jf.showOpenDialog(frame); File[] file = jf.getSelectedFiles(); for(int i=0;i<file.length;i
Java 2D
Java 2D  Hi, What is Java 2D? Thanks   Hi, Please see it at Java 2D API. Thanks
arrays
arrays  using arrays in methods   Java use arrays in methods import java.util.*; class ArrayExample{ public static int getMaxValue(int[] arr){ int maxValue = arr[0]; for(int i=1;i < arr.length;i
arrays
Store a table with students and information (name, ID, password, crypted password, etc) in a multi-dimensional array "stud"  Arrays and Strings: Store a table with students and information (name, ID, password, crypted password
Arrays
Arrays   Hi I need help with the following exercises. Exercise 1: Write a Java application in which the user is prompted for the total number of integer values to be stored in an array. Initialize the array with random values
using 2D Array
using 2D Array  Write a JAVA program using 2D Array to auto-grade exams. For a class of N students, your program should read letter answers (A, B, C, D) for each student. Assume there are 5 questions in the test. Your program
using 2D Array
using 2D Array  Write a JAVA program using 2D Array to auto-grade exams. For a class of N students, your program should read letter answers (A, B, C, D) for each student. Assume there are 5 questions in the test. Your program
Changing 2D graph using slider.
Changing 2D graph using slider.  Code for changing a 2d graph with help of slider
Java 2D Graphics - Applet
Java 2D Graphics  I am working on GIS project.I want represent a line in different forms like railroad, airplane etc. How can i acheive this I know the standard forms like dashed, dotted line.My code
java 2d graphics - Java Beginners
java 2d graphics  Hello All I need to use 2d graphics in java to build up a map from the given geographic coordinates. What i am not getting is how to scale down these geographic coordinates to device coordinates. I would
Arrays in java
Arrays in java  what is param array in java
Storing the Color Image pixel values into 2d array
Storing the Color Image pixel values into 2d array  i want to store the color image pixel values into 2d array and agiain the array have to store into a text file using java... plz provide the code
Selecting elements of 2D array with GUI
Selecting elements of 2D array with GUI  Hello! I am building a Java application with GUI (JFrame form) that is supposed to display all or selected elements of below 2D array (images attached): Year Season 2002 2003
Java 2D API
Java 2D API       Programming has become more interactive with Java 2D API. You can add images... 2D API. You can easily use 2D within Swing components such as drop shadows
java arrays
java arrays  i need a java program to store student details like id,name,addr,marks,average,total..using arrays..input data using scanner class and by using class, object and constructor
java arrays
java arrays  can i know how can we intilize the three dimentional arrays in java? and how can we assign thae values to that array
Java with Arrays
Java with Arrays  I was given the assignment to create two parallel arrays; both of size 50 (declares 50 as a constant) One is an array of strings... and store it in the arrays. The input for the problem should be provided in a text
java arrays
java arrays  how do you write the code for multipliying 2 double arrays to be in a 3rd double array? here is my code: package employeepay; /** * * @author Owner */ public class Main { /** * @param args the command line
Compare two Byte Arrays?
Compare two Byte Arrays?  Compare two Byte Arrays
Comparing arrays not working correctly?
Comparing arrays not working correctly?  Comparing arrays not working correctly
How to create arrays in JavaScript?
How to create arrays in JavaScript?  How to create arrays in JavaScript
create arrays in JavaScript
create arrays in JavaScript  How to create arrays in JavaScript
arrays in java - Java Beginners
arrays in java  Hi All, I have two arrays. in this two array some name are same. I want to merge those arrays into single. But while merging I want to delete duplicate entries. How merge those arrays. Thanks, mln15584
java; arrays - Java Beginners
java arrays example  How can you create a program, by using arrays and the output would be X. by using char or string.Thank you
Are arrays primitive data types?
Are arrays primitive data types?   Hi, Are arrays primitive data types? thanks   Hi, In Java, Arrays are objects. Identifier are some simple variable names which is defined as the value container. The type of value
What is javascript Arrays?
What is javascript Arrays?   Hi, I am learner of JavaScript. My question is that What is JavaScript Arrays ? How to Define the JavaScript arrays in you program. Please give an example show that i will try my self. Thanks
combine two arrays in php
combine two arrays in php  combine two arrays in php   $newArray = array_combine($diff, $pages_name['data']); foreach ($newArray as $data) { var_dump($data); exit('zzzzz'); echo $data . '<br>
reverse arrays in java
reverse arrays in java  how do i write a program in array of size n*m where both n and m are greater than 20 such that the 1st element of an array becomes the last and vice verse
reverse arrays in java
reverse arrays in java  how do i make a code that can be used to reverse the elements of an array in two dimension such that the last element of an array becomes the first element of the array and the first element of an array
Arrays in java 7
This tutorial describes the concept of Arrays in java 7
intersection of two java arrays
intersection of two java arrays  I am trying to figure out how to compare two arrays and get the intersection and put this into a third array of the correct size. I know how to copy the two arrays into the third array but am
Arrays in java
Arrays in java Arrays are the data structure of java , we use array where we need contiguous memory allocation. Array stores same type of data structure. Array type is checked at compile time. An array has a fixed length. Declaration
how to find inverse of n*n 2d array in java
how to find inverse of n*n 2d array in java  I reached upto code of printing the matrix as: Assume that matrix is square matrix where row=column code is: public class ReadContents{ public static void main(String args
code to display images using 2d array - Swing AWT
code to display images using 2d array  HI !! I have an image file in ascii/binary format (lines & pixels) in the form of a 2d-array. I would like to display this using java code. I am relatively new to coding
How to concatenate two arrays in Java?
How to concatenate two arrays in Java?  How to concatenate two arrays in Java
 

 

 

DMCA.com