Q1) Write a Prolog program to find the sum of odd numbers in an integer list.
Added by Vicente M.
Step 1
- Start by defining a predicate `sum_of_odds(List, Sum)` where `List` is the input list of integers and `Sum` is the output sum of all odd numbers in the list. Show more…
Show all steps
Close
Your feedback will help us improve your experience
Madhur L and 99 other Physics 102 Electricity and Magnetism educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Write a program in Python to calculate and display the sum of all odd numbers in the list
Shelayah R.
Give a recursive algorithm for finding the sum of the first n odd positive integers.
Sri K.
Recommended Textbooks
University Physics with Modern Physics
Physics: Principles with Applications
Fundamentals of Physics
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD