0% found this document useful (0 votes)
2 views4 pages

Ayaan Project 2 Array Programs

The document provides instructions for two Java programs: the first program counts and displays the number of even and odd integers in a 1D array of 10 integers, while the second program checks if a 3x3 matrix is symmetric. It includes variable descriptions for the arrays and counters used in both programs. The document outlines the necessary data types and structures for user input and processing.

Uploaded by

siddhusiddhu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

Ayaan Project 2 Array Programs

The document provides instructions for two Java programs: the first program counts and displays the number of even and odd integers in a 1D array of 10 integers, while the second program checks if a 3x3 matrix is symmetric. It includes variable descriptions for the arrays and counters used in both programs. The document outlines the necessary data types and structures for user input and processing.

Uploaded by

siddhusiddhu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Question

Write a Java program to input 10 integers in a 1D array, count and display the number of even numbers
and odd numbers present in the array.

Code:

Output:

Variable Description Table

Variable Data Type Description


arr int[] Array to store 10 integers
Variable Data Type Description
i int Loop counter
evenCount int Stores the count of even numbers
oddCount int Stores the count of odd numbers
sc Scanner For taking user input
Question

Write a Java program to input a 3×3 matrix and check whether it is a symmetric matrix or not.

[Hint: A symmetric matrix is a matrix which after transpose (rows become columns or vice versa) remain
same]

Code:

Output:
Variable Description Table

Variable Data Type Description


mat int[][] 2D array (matrix) of size 3×3
i, j int Loop counters for rows and columns
isSymmetric boolean Stores whether the matrix is symmetric
sc Scanner For taking user input

You might also like