• 03-23-2011, 03:00 PM
Prokopyo
Question Number 1

Write a java application that display and sums up all the even numbers from 1-20.

Sample Output:
Even numbers are
2 4 6 8 10 12 14 16 18 20 = the sum of all numbers is 110

Question Number 2

Using while loop display the multiplication table.

1 2 3 4 - 10
2 4 6 8 - 20
10 20 30 40 - 100

I really need an answer as soon as possible !

Thanks :)
• 03-23-2011, 03:05 PM
FlipPoker@gmail.com
Have you attempted to work this out on your own? Are you stuck on a particular concept or do you have no idea where to start?
• 03-23-2011, 03:07 PM
Prokopyo
I just don't know how to WRITE this JAVA APPLICATION.

Its my assignment in school then i did absent for one day.
Then my instructor give me that ASSIGNMENT . :(

• 03-23-2011, 03:16 PM
Prokopyo
can you give me a sample sir!

in using JAVA NETBEANS!
• 03-23-2011, 03:19 PM
FlipPoker@gmail.com
The thing is, we're not here to do your homework. I suggest you do the following:

1. Read your textbook and try to create a very simple Java program. There may even be a simple "Hello World" program for you to try.
2. In that program, you will probably have a main() method. You can add your own code to that main() method. That's where you can add your statements.
3. For Question 1, you can use a for loop to iterate through all of the numbers from 1-20. To determine if a number is even, use the modulus(%) operator. For example 8 % 2 will return 0. That means 8 is an even number.
4. Once you have determined that a number is even, add it to your running total.
5. When the for loop ends, display your running total.

After you get through Question 1, you will be better prepared to tackle Question 2.
• 03-23-2011, 03:20 PM
sunde887
Lets not spoonfeed him such simple code.

@op: we try not to give you code, you won't learn that way.

This is pretty easy(and logical)

Just google how loops work and then think how you would do this by hand and you can easily figure it out.
• 03-23-2011, 03:21 PM
Prokopyo

Help me! i really need it now :)

next time i'll google for it!
• 03-23-2011, 03:27 PM
Tolls
Quote:

Originally Posted by Prokopyo