FontysICT-sem1

Training - For - Math and so on

Nothing is more fun than math! Why not use math to teach repetition structures?

Case study 1 - The table of 3

Write a program that satisfies the following requirements:

  1. Display the table of 3 on the screen by using a for loop.

  2. Add a second project to your solution and again create a program that shows the table of 3, but using a while loop.

Case study 2 - The table of N

Write a program that satisfies the following requirements:

  1. Display the table of N on the screen by using a for loop. N is to be entered by the user in a TextBox.

  2. Add a second project to your solution and again create a program that shows the table of N, but using a while loop.

Case 3 - Loop with an if in it

Write a program that satisfies the following requirements:

  1. Create a program that can calculate the table of 8 and display it on the screen in a listbox (each item on a new line in the listbox). The program must work with a for loop.

  2. Every time the result is divisible by 3, the text “PARTICULAR” appears after the result in the listbox. For this you need the following techniques (do some preliminary research):

  3. Use the % operator to determine if a number is divisible by 3.

  4. The use of an if statement is mandatory.

Case study 4 - Nested loop

Write a program (console app) that can display the following text on the screen:

1\

22\

333\

4444\

55555

The algorithm must work with a generic loop (a loop within a loop).

Case Study 5 - Sum or product of certain set of numbers

Create a program that asks the user for a number and then displays the sum of all numbers up to and including this number on the screen. So, suppose the user enters 3, then the result is 1 + 2 + 3 = 6.

Adjust the program so that only multiples of 3 and 5 are included in the calculation. So, suppose the user enters 7, then the result is 3 + 5 + 6 = 14.

Adjust the program so that the user can choose whether to calculate the sum or multiplication of all numbers up to n. Thus, suppose the user enters 4 and asks for the sum, then the result is 1 + 2 + 3 + 4 = 10. Suppose the user enters 3 and asks for the product, then the result is 1 ___ 2 ___ 3 = 6.

Case Study 6 - Sum of a Range of Numbers

Create a program that shows the multiplication table up to 10 of a user-specified number. So, suppose the user enters 7, the result is 1 * 7 = 7, 2 * 7 = 14, …, 10 * 7 = 70. Put each product on a new line.