Answer to Question #336504 in Java | JSP | JSF for Jison

Question #336504

Write a java program using two-dimensional arrays that determines the ODD numbers among the 12 input values typed from the keyboard and prints the list of these ODD numbers.

1
Expert's answer
2022-05-02T13:36:41-0400
import java.util.Scanner;

public class Answer {
    public static void main(String[] args) {
        int[][] array = new int[12] [1];
        System.out.println("Enter numbers:");
        Scanner scanner =new Scanner(System.in);
        for (int i = 0; i < array.length; i++) {
            array[i][0] = scanner.nextInt();
        }
        System.out.print("ODD numbers: ");
        for (int i = 0; i < array.length; i++) {
            if (array[i][0] % 2 != 0) {
                System.out.print(array[i][0] + " ");
            }
        }

    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS