ArrayP4 - import java.util import java.lang import java.io...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.util.*; import java.lang.*; import java.io.*; import java.text.*; import java.math.*; import java.text.DecimalFormat; // Jeremy Debruce / public class ArrayP4 { static final int rows = 5; static final int columns = 5; static int i, j, n=1,min,row,md=0,sd=0,max=0; public static void main(String[] args) { //Stores array System.out.println("A"); int[][] array = new int [5][5]; int[][] arrayA= new int [5][5]; int[][] arrayB= new int [5][5]; for (i=0;i<5;i++) { for (j=0;j<5;j++) { array[i][j]=n; arrayA[i][j]=n; arrayB[i][j]=n; n=n+1; } } //Outputs the array for (i=0;i<5;i++) { for (j=0;j<5;j++) System.out.printf("%5s" ,array[i][j]+" "); System.out.println(); } System.out.println(); System.out.println(); System.out.println(); //outputs the sum of the third row System.out.println("B"); int sum=0; for (j=0;j<5;j++) sum=array[2][j]+ sum; System.out.println(); System.out.println("Sum => "+sum); System.out.println(); //interchange 3rd and 4th column System.out.println("F"); int temp;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/17/2011 for the course COMP 2302 taught by Professor Staff during the Spring '11 term at Kennesaw.

Page1 / 3

ArrayP4 - import java.util import java.lang import java.io...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online