Click here to Skip to main content
16,017,922 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
How to find the maximum and minimum value of an array without using any For Loop or any inbuild function in C#
Posted
Comments
[no name] 9-Mar-15 8:29am    
u can use foreach..
BillWoodruff 9-Mar-15 10:43am    
Not possible; you are wasting your time.

If you can't use loops or inbuilt functions, then you can't do anything: because you have a set of data of unknown size where you need to examine each element in order to find the largest or smallest.

If it's just a for loop your homework disallows, then try a foreach loop instead.

Otherwise, you have to use some inbuilt functions: Max, Min, Linq based iterative functions, or a Sorting function - you can't just "look" at a whole array and "see" the largest, any more that you physically could with a pack of cards in front of you.
 
Share this answer
 
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900