Logo 
Search:

Artificial Intelligence Articles

Submit Article
Home » Articles » Artificial Intelligence » ProLogRSS Feeds

Program to find the names of all the student who have obtained marks greater than equal to the Marks in the Subject specified at the goal prompt

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

Program to find the names of all the student who have obtained marks greater than equal to the Marks in the Subject specified at the goal prompt.

Code for Program to find the names of all the student who have obtained marks greater than equal to the Marks in the Subject specified at the goal prompt in Artificial Intelligence

domains
    student,subject = symbol
    marks,rollno = real
    
predicates
    go(subject,marks)
    greater(marks,marks)
    name_of(rollno,student)
    subject_liked(rollno,subject)
    marks_obt(rollno,marks)
clauses
    name_of(1,pinakin).
    name_of(2,muntaquim).
    name_of(4,dhaval).
    name_of(7,chitrangada).
    name_of(9,anand).
    name_of(10,neha).
    name_of(13,hetal).
    name_of(14,shomit).
    name_of(15,sajith).
    name_of(17,dhiren).
    name_of(18,hitul).
    name_of(21,divya).
    name_of(22,jignesh).
    name_of(23,priya).
    name_of(24,jyoti).
    name_of(25,vishal).
    name_of(26,aditi).
    name_of(27,shalin).
    name_of(28,apurva).
    name_of(29,yesha).
    name_of(32,taranum).
    
    subject_liked(1,dbms).
    subject_liked(2,dfs).
    subject_liked(4,ai).
    subject_liked(7,ai).
    subject_liked(9,ai).
    subject_liked(10,cg).
    subject_liked(13,dms).
    subject_liked(14,java).
    subject_liked(15,nt).
    subject_liked(17,dbms).
    subject_liked(18,sad).
    subject_liked(21,ai).
    subject_liked(22,cbms).
    subject_liked(23,dfs).
    subject_liked(24,nt).
    subject_liked(25,cbms).
    subject_liked(26,cbms).
    subject_liked(27,ss).
    subject_liked(28,os).
    subject_liked(29,sad).
    subject_liked(32,ooad).
    
    marks_obt(1,75).
    marks_obt(2,60).
    marks_obt(4,65).
    marks_obt(7,80).
    marks_obt(9,50).
    marks_obt(10,65).
    marks_obt(13,70).
    marks_obt(14,55).
    marks_obt(15,80).
    marks_obt(17,72).
    marks_obt(18,61).
    marks_obt(21,85).
    marks_obt(22,55).
    marks_obt(23,68).
    marks_obt(24,70).
    marks_obt(25,90).
    marks_obt(26,64).
    marks_obt(27,30).
    marks_obt(28,56).
    marks_obt(29,45).
    marks_obt(32,65).
    
    go(Subject,Marks):-
        subject_liked(Roll,Subject),
        marks_obt(Roll,What),
        greater(What,Marks),
        name_of(Roll,Name),
        write(Name," likes ",Subject ," and has " ,  What," marks"),nl,
        fail.
    
    go(Subject,Marks).
        
    greater(X,Y) :-
        X >= Y.
        
Output :

Goal: go(ai,60)

dhaval likes ai and has 65 marks
chitrangada likes ai and has 80 marks
divya likes ai and has 85 marks
Yes
  
Share: 



Milind Mishra
Milind Mishra author of Program to find the names of all the student who have obtained marks greater than equal to the Marks in the Subject specified at the goal prompt 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!