Baisc of Programming
Baisc of Programming
For your compiler/programming language you can use VB Excel just refer
to this link for quick toturial
https://www.youtube.com/watch?v=78GvLEAZecs
Data Types
string - consists of one or more characters
numeric data
integer (if no decimal on numeric data)
float/double, single (if decimal is present, double has higher space
allocation than single)
Boolean data - true/false, or 0/1
Variables - these are the names you give to the computer memory
allocations which are used to store values in computer program
Keyword - is a word reserved by a program because the word has a special
meaning
example: ”printf”, ”MsgBox”
Expected output: hi
Loops - is a sequence of instructions that is continually repeated until a
certain condition is reached
For Next Loop - allows you to perform task/s for the specified
number of time
Do While Loop - allows you to execute first the task/s before the
while condition is checked
While - allows you to check for a condition and run the loop while
that condition is met
Illustrations:
For this illustration we will assume that the variable age = 16.
1 For (i = 1 to age)
2 Do while loop
i = 16
Do
task = write the word ”hello”
i =i +1
while (i < age)
No output
( since condition is not satisfied thus the loop is terminated before the
rask is performed)
Practice!
Design a program that will compute the sum of all even integers from 1 to
20.
example:
Function Area (x (var type), y (var type)) (return type)
Area = x*y
End Function
Main Program
z (var type)
z = Area (3,5)
End Program
ACTIVITY 1
Design a program that will compute the product of all integers form 1
to 100 that are divisible by 8.
Submit a handwritten answer, write your name and section on the
upper left corner of your paper.
Submit your work on or before Feb. 16, 2023.