Lesson 4 – While/If

Find the Course here.


Introduction:
The mathematicians at Math Inc. need your help to calculate the Triangular numbers


What you will learn:

  • Primarily:
    • While loop
    • If
  • Secondarily:
    • Variables
    • Calculations

Client Name: Math Inc.


Process Name: Triangular Numbers


Description: Math Inc. needs a robot that that can calculate the Triangular Numbers and present them in a nice way:

  • Calculate the 15 first Triangular numbers. The Triangular numbers are calculated as

    \[x_n={{n(n+1)} \over 2 } \]

     where n represents positive whole numbers, that means 1, 2, 3 etc.

  • Open a Notepad and type in the results.
  • The mathematicians are a little superstitious so if a Triangular number contains the digit ‘3’ it should not be typed in Notepad.

Leave a Reply