[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LOGO-L> Mid Number



An intriguing little problem.
Here is my solution - a little bit of shuffling!

==================================

to middle :input

;; outputs the 'middle' of three numbers

	local "list
	make "list :input

	if (item 1 :list) > (item 2 :list)~
		[make "list (list item 2 :list item 1 :list item 3 :list)]
	if (item 2 :list) > (item 3 :list)~
		[make "list (list item 1 :list item 3 :list item 2 :list)]
	if (item 1 :list) > (item 2 :list)~
		[make "list (list item 2 :list item 1 :list item 3 :list)]
	
	op item 2 :list	
end

===================================

At 10:21 PM 8/14/98 +0300, Yehuda wrote:
> Hi,  I have a list of 3 numbers. How do I extract from them the
>middle-valued number? 
>  should output 7 and [2 8 8] should output 8.  Regards...  [[Yehuda]] 
>              _/ _/_/_/_/_/ _/_/_/_/ 
>                     _/ 
>                _/ 
>            _/ 
>              _/_/_/_/  http://www.geocities.com/CollegePark/lab/2276/ 
>e-mail: yehuka@beitberl.ac.il 
>  
Paul Dench
---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org.  Mail
questions about the list administration to logofdn@gsn.org.  To
unsubscribe send    unsubscribe logo-l    to majordomo@gsn.org.



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home