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 fisica
edwinsabogal
 
Interpretações 2010
Interpretações 2010Interpretações 2010
Interpretações 2010
Bruno Gonzaga
 
Proteinas
ProteinasProteinas
Proteinas
eluniko
 
Virtigo holding berhad
Virtigo holding berhadVirtigo holding berhad
Virtigo holding berhad
마 이환
 
Puente de Arganzuela
Puente de ArganzuelaPuente de Arganzuela
Puente de Arganzuela
BiaEsteves
 
Parqueciencias2011 1bach
Parqueciencias2011 1bachParqueciencias2011 1bach
Parqueciencias2011 1bach
pacorob484
 
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)
 

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

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 

Recently uploaded (20)

fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 

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