for Loop Exercise (1)

advertisement
Workshop Title
Workshop X – Section Y
MCT123 Module Title
Learning Outcomes
On completing this section and related learning
activities, you should be able to:
 Do this
 This
 This
 And this….
Comparing for and while test
for (counter=1; counter <= 10; ++counter)
{
/* other statements here */
}
counter = 1;
while (counter <= 10)
{
/* other statements here
++counter;
}
*/
Counting to 100
for (counter=1; counter <= 100; counter++)
{
printf(“%d\n”, counter);
}
Basic Symbols
Symbol
Meaning
,
Comma = AND
;
Semicolon = OR
:-
Colon-dash = ONLY IF
not
not = NOT
The ADDIE Model
Analysis
• Analyse
learner profile
Design
• Plan the
content
Development
• Assemble
content
assets
Implement
• Put into
practice
Evaluation
• Gather
feedback
Options for Content
Use
Existing
Resources
Use Open
Resources
Create
New
Materials
• Existing presentations & lecture
materials
• Existing online resources
•
•
•
•
NDLR (Ireland HE Resources)
Merlot (International Resources)
MIT Open Courseware
OpenLearn Open University
•
•
•
•
Write new text and/or audio
Source/create new graphics
Develop video demos
Create interactivity
for Loop Exercise (1)
Problem statement:
Write a program that sums up the even numbers from 2 to 100.
Pseudocode???
for Loop Exercise (2)
Initialize sum to 0
For number from 2 to 100
sum = sum + number
number = number + 2
Print sum
while or for?
• Everything that can be done with a for
loop can also be done with a while loop.
• For problems where the control variable
has specific initial and final values and
specific increment/ decrement values, so
that it follows a pattern, then a for loop
is the appropriate solution.
Design a Complete Learning Experience
Core learning materials
+
Discussion Questions/Activities
+
Assignments
+
Research Projects
+
Exams/Assessments
= Complete Online Course
Engage Interaction Example
Video: for Loop
Click on the video to play
Prolog

Logic Programming

Invented by Colmerauer & Kowalski

Implements Predicate Calculus
Alain Colmerauer

Goal Driven: searches for goals using
Depth-First Search

Can return multiple answers
Robert Kowalski
2. Write for an online audience
Short slide text
Summary
Introduced
Prolog
Introduced basic Prolog symbols and core Prolog
concepts such as rules, facts, goals and questions
Closed World
Assumption
Defined closed world assumption and examined its
application to Prolog
Prolog
Programming
Constructed sample programs and examined how
Prolog executes questions
Download