Question: Write code in Prolog that doubles the 2 nd last element in a list. For example: ?-double_penultimate( [1,4,3,8,10], X). X = [1,4,3,17,10]
Write code in Prolog that doubles the 2 nd last element in a list. For example: ?-double_penultimate( [1,4,3,8,10], X). X = [1,4,3,17,10]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
