Declare two dimensional array called Array2, Change the values of the first row by multiplying each value by two, Print all array elements using the nested for loops
- برمجة جافا
- 2022-04-19
- softwareEngineer
الأجوبة
import java.util.Scanner;
public class HelloWorld
{
public static void main(String[] args) {
int [][]Array2 = {{22, 15, 21, 76}, {43, 36,}, {1, 5, 11}, {564}};
for(int columns=0;columns<Array2[0].length;columns++)
{
Array2[0][columns]=Array2[0][columns]*2;
}
//print all array elements using nested loop:
for(int rows=0;rows<4;rows++)
{
for(int columns=0;columns<Array2[rows].length;columns++)
{
System.out.print(Array2[rows][columns]+" ");
}
System.out.println("");
}
}
}
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال