Institute of Computer Science
  1. Courses
  2. 2020/21 fall
  3. Introduction to Programming II (MTAT.03.256)
ET
Log in

Introduction to Programming II 2020/21 fall

  • Home
  • Grading
  • Links

Homework 5

The deadline is Sunday, the 13th of December, 23:59 (Estonian time).

Exercise 1. Fractal

The following image contains examples of a fractal (orders 1, 2, 3, 4 and 5). Write a recursive function which takes the order number and the length of the tree (a tree is the fractal of order 1) as the arguments, and draws the fractal of the corresponding order. Demonstrate the work of your function drawing the fractal of order 5.

Exercise 2. Sum of the first n numbers

Write a recursive function that returns the sum of the first n integers. For example, the sum of the first 6 numbers is 6+5+4+3+2+1=21.

Go to Moodle and upload your solution into Homework 5.

  • Institute of Computer Science
  • Faculty of Science and Technology
  • University of Tartu
In case of technical problems or questions write to:

Contact the course organizers with the organizational and course content questions.
The proprietary copyrights of educational materials belong to the University of Tartu. The use of educational materials is permitted for the purposes and under the conditions provided for in the copyright law for the free use of a work. When using educational materials, the user is obligated to give credit to the author of the educational materials.
The use of educational materials for other purposes is allowed only with the prior written consent of the University of Tartu.
Terms of use for the Courses environment