Logo 
Search:

Artificial Intelligence Articles

Submit Article
Home » Articles » Artificial Intelligence » ProLogRSS Feeds

ProLog Program to print user entered number

Posted By: Milind Mishra     Category: Artificial Intelligence     Views: 3302

Program to print user entered number........

Code for ProLog Program to print user entered number in Artificial Intelligence

predicates
   action(integer)

clauses
   action(1) :- !,
      write("You typed 1.").

   action(2) :- !,
      write("You typed two.").

   action(3) :- !,
      write("Three was what you typed.").

   action(_) :- !,
      write("I don't know that number!").

goal
   write("Type a number from 1 to 3: "),
   readreal(Choice), 
   action(Choice).   
   
  
Share: 


Didn't find what you were looking for? Find more on ProLog Program to print user entered number Or get search suggestion and latest updates.

Milind Mishra
Milind Mishra author of ProLog Program to print user entered number is from India.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!