Results 1 to 9 of 9

# Thread: Please help me with this problem

- 03-23-2011, 03:00 PM #1Member
- Join Date
- Mar 2011
- Posts
- 4

- Rep Power
- 0

## Please help me with this problem

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

Please help me !

I really need an answer as soon as possible !

Thanks :)

- 03-23-2011, 03:05 PM #2Senior Member
- Join Date
- Mar 2011
- Posts
- 103

- Rep Power
- 0

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 #3Member
- Join Date
- Mar 2011
- Posts
- 4

- Rep Power
- 0

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 . :(

Please help!

- 03-23-2011, 03:16 PM #4Member
- Join Date
- Mar 2011
- Posts
- 4

- Rep Power
- 0

can you give me a sample sir!

in using JAVA NETBEANS!

- 03-23-2011, 03:19 PM #5Senior Member
- Join Date
- Mar 2011
- Posts
- 103

- Rep Power
- 0

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 #6
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3

- Rep Power
- 10

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 #7Member
- Join Date
- Mar 2011
- Posts
- 4

- Rep Power
- 0

Please sir !

Help me! i really need it now :)

next time i'll google for it!

- 03-23-2011, 03:27 PM #8Moderator
- Join Date
- Apr 2009
- Posts
- 12,966

- Rep Power
- 22

- 03-23-2011, 03:28 PM #9
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3

- Rep Power
- 10

## Bookmarks