Scratch with Microbit : Algorithm

Page 1

Algorithms

What is an Algorithms?

A step-by-step procedure for solving a problem is called Algorithms.”

Coding algorithms are especially useful because they can solve big problems much more quickly than humans can. In fact, certain problems that are too complex to solve mathematically can be solved with algorithms.

Let’s see how we can write algorithms to solve a given problems-

Step 1: Start

Step 3: Read values for num1, num2.

Step

Making an algorithm of the sum of two numbers-
Step 2: Declare variables num1, num2 and sum.
4: Add num1 and num2 and assign the result to a variable sum.
Step 5: Display sum
Step 6: Stop

Algorithm for adding two numbers

Code It Create a Script in Scratch, along with microbit to arrange all these given numbers in a sequence:

Code It:

To run this script press the button ‘A’ in the microbit and it will show the correct sequence of numbers in Scratch.

Explore More ❏ Experiment with different sequence examples like days, months names, etc. ❏ Write a script for this given example to correctly put the days of the week in a sequence.

Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.