SlideShare a Scribd company logo
1 of 2
Download to read offline
Exercise:

. Write a predicate called sum_of that works exactly like
length_of, except that it takes a list of numbers and adds them
up.

For example, the goal:

sum_of([1, 2, 3, 4], S).

should bind S to 10.

Program:




Output:
Write a complete Programe in Prolog to find result of this
seqence
S=1+2+3+...+N
Program:




                Output:

                                          ASmaa Almalki

More Related Content

Viewers also liked

Ejercicios de fisica
Ejercicios de fisicaEjercicios de fisica
Ejercicios de fisicaedwinsabogal
 
الوجيز في شرح قراءات القراء الثمانية
الوجيز في شرح قراءات القراء الثمانيةالوجيز في شرح قراءات القراء الثمانية
الوجيز في شرح قراءات القراء الثمانيةسمير بسيوني
 
الحرب على الكسل
الحرب على الكسل الحرب على الكسل
الحرب على الكسل abdou abousofiane
 
Interpretações 2010
Interpretações 2010Interpretações 2010
Interpretações 2010Bruno Gonzaga
 
Turning Failures into Faith
Turning Failures into FaithTurning Failures into Faith
Turning Failures into FaithJan Louie Uy
 
Proteinas
ProteinasProteinas
Proteinaseluniko
 
Islam, the religion of peace, friendship, kindness and mercy
Islam, the religion of peace, friendship, kindness and mercyIslam, the religion of peace, friendship, kindness and mercy
Islam, the religion of peace, friendship, kindness and mercymalisahmad
 
Virtigo holding berhad
Virtigo holding berhadVirtigo holding berhad
Virtigo holding berhad마 이환
 
Puente de Arganzuela
Puente de ArganzuelaPuente de Arganzuela
Puente de ArganzuelaBiaEsteves
 
Parqueciencias2011 1bach
Parqueciencias2011 1bachParqueciencias2011 1bach
Parqueciencias2011 1bachpacorob484
 
Y7 a2 ostrich boys lesson 7 (eid)
Y7 a2 ostrich boys lesson 7 (eid)Y7 a2 ostrich boys lesson 7 (eid)
Y7 a2 ostrich boys lesson 7 (eid)John Kirkman
 
العقيده المسيحيه الكنيسه
العقيده المسيحيه   الكنيسهالعقيده المسيحيه   الكنيسه
العقيده المسيحيه الكنيسهIbrahimia Church Ftriends
 
Gondolati napló - Puli feljegyzései II.
Gondolati napló - Puli feljegyzései II.Gondolati napló - Puli feljegyzései II.
Gondolati napló - Puli feljegyzései II.Nagy Attila (Mihai)
 
Eliaavalos
EliaavalosEliaavalos
Eliaavaloscolegio
 

Viewers also liked (20)

Sombras Em Cónica 1
Sombras Em  Cónica 1Sombras Em  Cónica 1
Sombras Em Cónica 1
 
Sept 29wiki
Sept 29wikiSept 29wiki
Sept 29wiki
 
Ejercicios de fisica
Ejercicios de fisicaEjercicios de fisica
Ejercicios de fisica
 
الوجيز في شرح قراءات القراء الثمانية
الوجيز في شرح قراءات القراء الثمانيةالوجيز في شرح قراءات القراء الثمانية
الوجيز في شرح قراءات القراء الثمانية
 
الحرب على الكسل
الحرب على الكسل الحرب على الكسل
الحرب على الكسل
 
Interpretações 2010
Interpretações 2010Interpretações 2010
Interpretações 2010
 
Turning Failures into Faith
Turning Failures into FaithTurning Failures into Faith
Turning Failures into Faith
 
01 04 esocinematica
01 04 esocinematica01 04 esocinematica
01 04 esocinematica
 
Proteinas
ProteinasProteinas
Proteinas
 
Irony pp
Irony ppIrony pp
Irony pp
 
Bbm ba
Bbm baBbm ba
Bbm ba
 
Islam, the religion of peace, friendship, kindness and mercy
Islam, the religion of peace, friendship, kindness and mercyIslam, the religion of peace, friendship, kindness and mercy
Islam, the religion of peace, friendship, kindness and mercy
 
Virtigo holding berhad
Virtigo holding berhadVirtigo holding berhad
Virtigo holding berhad
 
Puente de Arganzuela
Puente de ArganzuelaPuente de Arganzuela
Puente de Arganzuela
 
Parqueciencias2011 1bach
Parqueciencias2011 1bachParqueciencias2011 1bach
Parqueciencias2011 1bach
 
Y7 a2 ostrich boys lesson 7 (eid)
Y7 a2 ostrich boys lesson 7 (eid)Y7 a2 ostrich boys lesson 7 (eid)
Y7 a2 ostrich boys lesson 7 (eid)
 
Introduction
IntroductionIntroduction
Introduction
 
العقيده المسيحيه الكنيسه
العقيده المسيحيه   الكنيسهالعقيده المسيحيه   الكنيسه
العقيده المسيحيه الكنيسه
 
Gondolati napló - Puli feljegyzései II.
Gondolati napló - Puli feljegyzései II.Gondolati napló - Puli feljegyzései II.
Gondolati napló - Puli feljegyzései II.
 
Eliaavalos
EliaavalosEliaavalos
Eliaavalos
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of PlayPooky Knightsmith
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17Celine George
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxakanksha16arora
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111GangaMaiya1
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Celine George
 
Simple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfSimple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfstareducators107
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSAnaAcapella
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 

Recently uploaded (20)

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of Play
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptx
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17
 
Simple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfSimple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdf
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 

Pdf 3

  • 1. Exercise: . Write a predicate called sum_of that works exactly like length_of, except that it takes a list of numbers and adds them up. For example, the goal: sum_of([1, 2, 3, 4], S). should bind S to 10. Program: Output:
  • 2. Write a complete Programe in Prolog to find result of this seqence S=1+2+3+...+N Program: Output: ASmaa Almalki