Variable - A location in memory were the value can change during the duration of the program.
Constant - A location in memory were the value can not change during the duration of the program.
A variable is a location in memory were the value can change during the duration of the program. The different types of variables typically include integer, real, Boolean, character and string.
Constant is a location in memory were the value can not change during the duration of the program. Constants are useful because they are declared and assigned once, but can be referred to again throughout the program. They are used for values that are unlikely to change.
Computers are designed to carry out calculations. Mathematical operators allow arithmetic to be performed on values.
Comparison operators allow for comparisons and assignment to be made.
Example of DIV and MOD:
31 DIV 5 = 6 , as 5 goes into 31 6 times
The operator DIV is used for integer division
31 MOD 5 = 1 , as 5 goes into 31 6 times but 1 remains after
MOD is used to find the remainder when dividing one integer by another
Most programs accept data from the user, process it in some way, and output a result.
Example in python:
name = input("What is your name")
print("Hello", name)
Sequencing allows a programmer to solve complex tasks through a number of simple steps.
The order of steps in most tasks matters – similarly, we use brackets in maths to make sure that certain operations are done before others (sometimes we need to add before we do multiplication and division).
Sequencing is step by step, or line by line, progress through a program.
The use of selection allows a computer make decisions
Selection changes the flow of a program, depending on a set of conditions, it is used for validation and calculations.
Iteration means repetition in your code this could be through the use of while and for loops. There are 2 types of iteration, count and condition-controlled loops.
Count-controlled iteration involves executing a loop a predetermined number of times.
Condition-controlled iteration involves executing a loop until a certain condition is met.