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

Go down 
Elite Member
Elite Member

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

Character sheet
Weapon: Chakrams
Class: Ninja Ninja
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.

% 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):-(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
Back to top 
Page 1 of 1
 Similar topics
» Advice on how to research RD (registered design) numbers.
» I'm trying to find a particular painting/artist.
» How to find out a IP address via email
» racial maximum of goblin stats
» Maximum Warband Size - House Rules

Permissions in this forum:You cannot reply to topics in this forum
Jubecron Forum :: School :: Schools (General)-
Jump to: