14,325,446 members
Rate this:
See more:
I have a set of numbers (6,78,64,-1,6,-1), (those are not in array and that values get from a loop reading).From that numbers, I want to a method to find the minimum value [that minimum shouldn't be negative value(-1)].

Like this,
67,8,9,2,34,-1,5 -------; minimum = 2
if all values are (-1) then -1,-1,-1,-1,-1,-1------ ; minimum =-1

Posted
Updated 21-Nov-15 4:55am
v3
Tomas Takac 21-Nov-15 11:01am

That's a nice homework. What have you tried? Where are you stuck?
BillWoodruff 21-Nov-15 22:24pm

Rate this:

## Solution 1

No, a big NO. No one's from here going to find anything for you. It's your homework, you should do it.
"You won't be learn anything, if you expect others do your work for you".

You can try something on your own at first and when you stuck anywhere, anyone from here would do his/her best to help you out. But don't directly ask for the source code.

-KR
Kasthuri Gunabalasingam 21-Nov-15 11:40am

This is not a homework.. I'm doing a c# based project. this is require for to do a task!
PIEBALDconsult 21-Nov-15 13:57pm

And yet I think someone asked the same question a few months ago.
Kasthuri Gunabalasingam 21-Nov-15 14:11pm

aw..but I didn't check that
Rate this:

## Solution 2

How would you do it manually?

If someone reads you a set of numbers you would probably write them down one by one on a paper.
For the minimum number you would start with a very big number and write to the side, the saved min value.
For every new number you compare if it is smaller than the saved min value and if it is you scratch the old min value out and replace it with the new.
Unless it is -1, then you just ignore it and continue.