Results 1 to 7 of 7
Thread: Negative elements
- 12-14-2008, 06:32 AM #1
Member
- Join Date
- Oct 2008
- Posts
- 7
- Rep Power
- 0
- 12-14-2008, 06:35 AM #2
Member
- Join Date
- Nov 2008
- Posts
- 67
- Rep Power
- 0
Are the elements in an array, arraylist, linked list, etc.? You need to provide more information...
- 12-14-2008, 06:48 AM #3
Member
- Join Date
- Oct 2008
- Posts
- 7
- Rep Power
- 0
This is only sequence.
Doesn't mater array or arraylist.
I want just return negative eliments.
- 12-14-2008, 06:50 AM #4
Member
- Join Date
- Nov 2008
- Posts
- 67
- Rep Power
- 0
I don't understand what you are asking... Sorry
- 12-14-2008, 06:50 AM #5
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 12-14-2008, 04:35 PM #6
Guessing...
Let's see if I can help figure this out, becasue I'm not even sure the OP knows what he/she wants.
From this I assume the following:Return number of negative elements in java.
This is only sequence.
Doesn't mater array or arraylist.
- From a list (doesn't matter in what format) the OP has to return the number of negative elements.
please write code including for loop.- The code must contain a "for" loop.
With those requirements, I would think the following would be enough:
- Create list of numbers that contain some negative numbers. I would suggest an array.
- Using a "for" loop to go through the array, compare each array element if it's a negative number (using an "if" statement).
- If yes, then increment the counter and continue with the comparation.
- If not, just continue with comparation.
- Print the amount of negative numbers found in the array
swika: It's this what you need to do?
Luck,
CJSLChris S.
Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.
- 12-15-2008, 04:48 AM #7
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
It's better our thread starter clarify us on this.
Similar Threads
-
[SOLVED] Array of first negative number
By random0munky in forum New To JavaReplies: 9Last Post: 12-08-2008, 11:17 PM -
Missing Elements
By princess in forum NetBeansReplies: 1Last Post: 10-29-2008, 11:51 PM -
deleting elements
By nalinda in forum New To JavaReplies: 2Last Post: 12-06-2007, 01:42 AM -
Help with array of elements
By zoe in forum New To JavaReplies: 1Last Post: 07-24-2007, 05:33 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks