Jubecron Forum

The JUBECRON forum - Jamaican Chat, Dating, Games, Anime, and just meeting people.
 
HomePortalFAQSearchRegisterMemberlistUsergroupsLog in
Share | 
 

 Find the maximum of three numbers using Prolog

View previous topic View next topic Go down 
AuthorMessage
Beezle
Elite Member
Elite Member


Female
Number of posts: 547
Age: 24
Mood:
Points: 253
Registration date: 2008-03-02

Character sheet
Weapon: Chakrams
Class: Ninja Ninja
HP:
50/50  (50/50)

PostSubject: Find the maximum of three numbers using Prolog   Fri Oct 29, 2010 8:16 pm

This code can be modified to find the maximum of any number of inputs.

Code:
% Author: Claudia-Ann Gray
% Date: 10/29/2010

max:-write('Enter first number'),nl, read(Num1),nl,write('Enter second number'),
                  nl,read(Num2),nl,write('Enter third number'),nl,read(Num3),
                  find_max(Num1,Num2,Num3).
find_max(Num1,Num2,Num3):-(Num1>Num2,Num1>Num3->nl,write(Num1),write(' is the biggest'),!);
                  (Num2>Num3->nl,write(Num2),write(' is the biggest'),!);nl,write(Num3),
                  write(' is the biggest'),!.
Back to top Go down
View user profile
 

Find the maximum of three numbers using Prolog

View previous topic View next topic Back to top 
Page 1 of 1

 Similar topics

-
» The Power Of Birthdays Stars And Numbers.rar
» Dolphins work out two linebackers; uniform numbers updated
» Dolphins' 2011 rookie class assigned jersey numbers
» Where can i find Morden Tor?
» Find Chuck

Permissions in this forum:You cannot reply to topics in this forum
Jubecron Forum ::  :: -