This study put four steps, problem decomposition, pattern recognition, abstraction, and algorithm, into practice by integrating the blocky programming language, Scratch, into a mathematics course. The teacher guided the sixth-graders to apply the four steps of computational thinking to writing a blocky program to solve daily-life equality axiom mathematics problems. The results showed that the method was beneficial for promoting the learning effectiveness of mathematics, and also found that there was a significantly positive correlation between the performance of blocky programming and the mathematics post-test. There was no significant correlation between creative tendency and self-efficacy after the experiment. Self-efficacy had a positive correlation to learning motivation both before and after the experiment.