VB icon

Odd and Even Numbers in Java using Two Dimensional Array

Email
Submitted on: 10/4/2015 12:21:46 PM
By: Jake R. Pomperada  
Level: Beginner
User Rating: Unrated
Compatibility: Java (JDK 1.1), Java (JDK 1.2), Java (JDK 1.3), Java (JDK 1.4), Java (JDK 1.5)
Views: 4598
author picture
 
     A simple program that I wrote in Java programming language that will list down the odd and even numbers from the values given by the user using two dimensional array as our data structure. I hope you will find my work useful in your programming projects and assignments. If you have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com. My mobile number here in the Philippines is 09173084360.

 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: Odd and Even Numbers in Java using Two Dimensional Array
// Description:A simple program that I wrote in Java programming language that will list down the odd and even numbers from the values given by the user using two dimensional array as our data structure. I hope you will find my work useful in your programming projects and assignments.
If you have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com. 
My mobile number here in the Philippines is 09173084360.
// By: Jake R. Pomperada
//**************************************

/*
odd_even_numbers_array.java
Programmer By: Mr. Jake R. Pomperada, MAED-IT
Date : July 23, 2015
Tools: NetBeans 8.0.2, Java SE 8.0
Problem No. 2:
 
Write a program that will ask the user to give ten numbers and then
the program will enumerate the odd and even numbers based on the 
given numbers by the user. Kindly use two dimensional array as
your data structure in this problem.
*/
 
import java.util.Scanner;
class odd_even_numbers_two_dimesional {
public static void main(String[] args) {
 
 Scanner input = new Scanner(System.in);
 char ch;
 do { 
 int [][] values; 
 values = new int[10][1]; 
 int x=0;
 System.out.print("ODD AND EVEN NUMBERS PROGRAMS");
 System.out.println();
 for (int a=0; a<10; a++){
 for (int b=0; b<1; b++) 
 {
 System.out.print("Enter value in item no. " + (a+1) + " : ");
 values[a][b] = input.nextInt();
}
 } 
 System.out.println(); 
 System.out.print("LIST OF EVEN NUMBERS");
 System.out.println();
 for (int a=0; a<10; a++)
 {
 for (int b=0; b<1; b++) 
 {
if(values[a][b]%2 == 0) {
System.out.print(" " + values[a][b]+ " ");
}
 }
 }
 System.out.println(); 
 System.out.print("LIST OF ODD NUMBERS ");
 System.out.println(); 
 for (int a=0; a<10; a++)
 {
 for (int b=0; b<1; b++) 
 {
 if(values[a][b]%2 != 0) {
 System.out.print(" " + values[a][b]+ " ");
}
 }
 } 
 System.out.println("\n\n"); 
 System.out.print("\nDo you want to continue (Type y or n) : ");
 ch = input.next().charAt(0);
 } while (ch == 'Y'|| ch == 'y'); 
 System.out.println();
 System.out.print("\t THANK YOU FOR USING THIS PROGRAM");
 System.out.println("\n\n");
 }
} // End of Code


Other 53 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.