Hello! Badly need help. I need to do a program that will produce odd & even numbers using loop structure

Sample output:

Enter a number: 5
This number is an odd number!
Input 1 to run the program again
Input 2 to stop
Enter your Choice: 1
Enter a number: 6
This number is and even number!
Input 1 to run the program again
Input 2 to stop
Enter your choice: 2


Recommended Answers

All 3 Replies

This is the standard reply we give users with your type of question, don't take it personally.
We don't just do your project for you. By all means, we will help you if you are stuck and having trouble. But we won't jump in and give you the answer because it doesn't help you get any better.
Posting up what you done so far, or what you have tried, will get your better responses.

So, how much of the question do you understand and can you show us what you've done so far?

DaniWeb Member Rules (which you agreed to when you signed up) include:
"Do provide evidence of having done some work yourself if posting questions from school or work assignments"

I don't know whether you have started/completed this work all by yourself. If you don't know how to start with I will give you few hints, based on that try to do it.

  1. In order to get the number from the user try java.util.Scanner and store it in a variable
  2. Next use if condition to check the remainder of the number divided by 2 equals 0
  3. Use the same scanner for Input 1 to run the program again as well.

Hope this helps.

Varun Krishna. P

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.