sum - Get list of two numbers that add up to a number in prolog -


उदाहरण के लिए, getNumbers (M, C, 10) M = 10, C = 0 और amp; amp; एम = 9, सी = 1 & amp; amp; एम = 8, सी = 2 ... आदि आदि

आप सुझाए गए बीच में से उपयोग करना:

<पूर्व> getNumbers (एम, सी, एस): - के बीच (0, एस, एम), सी एस एम है।

और पूरी सूची प्राप्त करने के लिए findall / 3 का उपयोग करेगा, उदा यह क्वेरी:

 ? - खोजल ([एम, सी], मिलते हैं (एम, सी, 5) नंबर)। संख्या = [[0, 5], [1, 4], [2, 3], [3, 2], [4, 1], [5, 0]]।  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -