Lesson objectives
10.4.1.1 Write code in a programming language using functions and procedures
Success criteria
Describes the function / procedure parameters
Uses function / procedure when solving problems
Creates its own function / procedure to solve practical problems
4
Task 1
Write a procedure called “Display” that will prompt the user to enter two integer numbers n and m, and will display all the numbers from n until m. i.e.
If n = 4, m = 9 it will display: 4 5 6 7 8 9
Also, write the main program to call the procedure “Display”.
Draw the flowchart of the above program.
Descriptors:
5
Task 2
Write a procedure called “Sum” that will prompt the user to enter two integer numbers n and m, and will display the sum of all the numbers from n until m. i.e.
If n = 2, m = 6 it will display: 20
since 2 + 3 + 4 + 5 + 6 = 20
Descriptors:
6
Task 3
Write a program to ask for the price of a product and display the discount. The discount which is 15% will be calculated and displayed in the procedure “Discount”, that will take the price as a value formal parameter.
Draw the flowchart of the above program.
Descriptors:
Individual work
Create a method that defines even and odd numbers.
Create a method that defines the area and length of the circle.
Материалы на данной страницы взяты из открытых источников либо размещены пользователем в соответствии с договором-офертой сайта. Вы можете сообщить о нарушении.