Advertisement
Tusohian

Result Compare in Prolog

Jun 27th, 2019
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 0.66 KB | None | 0 0
  1. /*Section A*/
  2. result(anik,3.52).
  3. result(runa,3.22).
  4. result(luna,3.60).
  5. result(rabbi,3.67).
  6. result(anika,3.00).
  7.  
  8.  
  9. /*Section B*/
  10. result(urmi,3.55).
  11. result(raima,3.12).
  12. result(robi,2.60).
  13. result(alok,3.64).
  14. result(pia,3.10).
  15.  
  16.  
  17. getresult:-
  18. write('Enter the name of the student of section A: '),read(X),nl,
  19. result(X,Y),
  20. write(Y),nl,
  21.  
  22. write('Enter the name of the student of section B: '),read(A),nl,
  23. result(A,B),
  24. write(B),nl,
  25. compare(Y,B).
  26.  
  27. compare(Y,B):-
  28. Y>B,write('maximum result is='),write(Y),nl,write('Section A student is good');
  29.  
  30. B>Y,write('maximum result is='),write(B),nl,write('Section B student is good');
  31.  
  32. Y=:=B,write('both are same').
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement