Welcome to the Meow Star Public Account. Today, we continue to explain the tutorial from 【I Love Mushroom xmg】—Micro:bit sequence programming fun applications. Let’s get started!
For the practical use of Teacher Shao’s font library, please refer to this tutorial.【Micro:bit】Fall in love with little bit, cool play with sequence and mini games.
Calculate the sum of even numbers in a sequence
【I Love Mushroom xmg Preface】Madecode’s execution of for loops is different from other languages. The program for calculating the sum of even and odd numbers is difficult to write. When calculating the sum of even numbers, I can solve it by incrementing the pointer by 1. I have not yet found the correct method for the odd number algorithm in this language environment. I look forward to any teacher who can join in and find a solution.
Find the largest number among several numbers
【I Love Mushroom xmg Preface】At noon, the big kid came back and wanted his mom to spend money to buy an N20 motor. He is full of confidence to make an excavator and has been picking it on Taobao for a week. Last year, he made his mom spend money on a reduction track motor, a three-way switch, and so on, but he still hasn’t learned how to play with them. He wants to spend money and write a few small programs first.The first question: find the larger of two numbers. I originally wanted him to write the specific algorithm process, but the little rascal directly solved the problem using command blocks.
The second question: how to find the largest of three numbers;The little guy used two comparisons again, which is still different from his mom’s programming thinking. In any case, the problem was solved, and he should still be praised. This post records the child’s learning journey.
Sort three numbers in descending order
【I Love Mushroom xmg Preface】The third assignment: arrange the given three numbers from largest to smallest.Initially, I wanted him to draw a diagram to sort out his thoughts, but he refused, saying he couldn’t draw. He wouldn’t let me see his programming, just thinking hard by himself.Although the program is a bit lengthy, it really made mom happy, and the result was verified to be correct. This is used to exercise the child’s mathematical programming thinking.Program screenshots:
Today’s tutorial ends here. We welcome enthusiasts to come and experience this great tutorial. Don’t you want to share it with your friends? Of course, if you like it, don’t forget to give this cat a thumbs up!