BIS1003-Introduction to Programming Intensive
BIS1003 Introduction to Programming
Workshop 4
Topic 4: Repetition Structures
Apply and test your knowledge of the current and previous topics by attempting the questions below.
Completing these questions will help you to succeed in your subject.
Complete workshop-4 activities and submit your work during the workshop session.
Workshop Questions
1. Write a program to calculate the sum of a series of positive numbers. The program
should ask the user to enter the numbers one by one. The user should enter a
negative number to signal the end of the series. When the loop is finished, the
program should display the sum of all the positive numbers.
2. Write a program to calculate the sum of the following series. The program should
prompt the user for a positive integer, n and display the sum of the series.
3. At a primary school, the study fee for a term is $4500. The school will increase by 2%
each year for the next 3 years. Write a python program using “for loop” that displays
the projected semester fee amount for the next 3 years.
4. Write a program that asks the user to enter a positive integer, n. Based on the value
of n, the program should use a nested loop to draw the following pattern with n rows:
* ***
*****
*******
*********