write a program lower left half which takes two dimensional array a , with size n rows and n column as argument and prints the lower half
Attachments:
Answers
Answered by
4
Program:-
This is the required program for the question.
import java.util.*;
class Arrays
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int N;
System.out.print("Enter the number of rows for the 2d array: ");
N=sc.nextInt();
System.out.println("Enter the numbers in the matrix.");
int a[][]=new int[N][N];
//taking input
for(int i=0;i<N;i++)
{
for(int j=0;j<N;j++)
{
System.out.print("["+i+"]["+j+"] = ");
a[i][j]=sc.nextInt();
}
System.out.println();
}
}
//displaying on screen
for(int i=0;i<N;i++)
{
for(int j=0;j<=i;j++)
System.out.print(a[i][j]+"\t");
System.out.println();
}
}// end of main()
}// end of class.
Answered by
0
Answer:
Explanation: I didn't understand
Similar questions