Computer Programming
Computer Programming
Definition of Terms
Language is a system of communication by written or spoken word which is used by the people
of a particular country or area.
A program is a series of instructions which enable the computer to carry out some laid down
procedures to accomplish a given task or solve a problem.
Programming is the act of giving the computer a set of instructions or codes to carry out, or
perform a specific task.
Programming can also be said to be the process of taking the step in a procedure and putting
such in special languages (coding), which is the computer can understand.
1. Machine Language: This language is made up of binary numbers. This means the
character set of machine language contains only 0s and 1s (zeros and ones). It requires
no translation hence the name machine language. It is the native language of a computer.
Machine language is machine dependent. This means machine language programs are not
portable.
a. PASCAL
c. C ++
d. Java
g. PROLOG
k. Python
Comparison of Machine Language, Low Level Language (assembly language) and High
Level language
Language Characteristics
3. 1 to 1 language
SUMMARY:
Language is a system of communication by written or spoken word which is used by the people
of a particular country or area.
Computer language is a system of instructions and commands for operating a computer. It is a
language that the computer understands and executes.
A program is a series of instructions which enable the computer to carry out some laid down
procedures to accomplish a given task or solve a problem.
Programming is the act of giving the computer a set of instructions or codes to carry out, or
perform a specific task.
Programming can also be said to be the process of taking the step in a procedure and putting such
in special languages (coding), which is the computer can understand.
A computer programming language is a large number of steps required to carry out a procedure,
for example, to compute student examination scores.
Low-Level Language Unlike human beings, the computer understands codes of digital binary
numbers.
NEW: New is used when you want to start a new program
OPEN: When you want to update a program that you already worked on, choose open and then
choose the program that you wish to work on
SAVE: When you have saved a program once before and you want to save it again, choose save.
Save your work often
SAVE AS: When you want to save a program for the first time, choose Save As. You then have
to give your program a name. Your program name should not be more than 8 letters long.
PRINT: Choose print when you want to send your program to the printer.
BASIC IN PROGRAMMING
KEYWORDS IN BASIC
1. REM STATEMENT
The REM statement is a remark statement. It is used to insert remarks in the program. Such
remarks are used to explain what the program is all about.
Example:
2. LET STATEMENT
Examples:
10 LET A = B + C
3. INPUT STATEMENT
Input is used to assign or give values to variables while program is running. It can be used with
both numeric and string variables.
Examples:
10 INPUT A, B, C
4. PRINT STATEMENT
The print statement tells your computer to display the output of the executed program on the
screen of the monitor (VDU).
Example:
10 PRINT SUMS
5. END STATEMENT
End Statement is an instruction used to terminate the program. One the computer encounters
END statement, it automatically terminates the program.
50 END
6. RUN STATEMENT
The RUN statement is used to execute a program. In Q-BASIC, F5 is used to RUN a program.
Note that the program will not RUN if any mistake or error is detected in it.
PROGRAM SAMPLE
Solution:
200 LIST:
300 PROD
400 READ A, B, C
500 DATA 3, 4, 9
700 PRINT P
800 END
Solution:
10 CLS
30 PRINT area
30 END
Solution:
S.I. = PRT
100
Begin
INPUT P, R, T
S.I. = (P*R*T)/100
PRINT 1
Solution:
CLS
INPUT Number 1
INPUT Number 2
PRINT “TOTAL”
END
CLS
INPUT NUMBER 1
INPUT Number 2
INPUT Number 3
AVERAGE = TOTAL/3
END
Solution:
CLS
INPUT base
INPUT height
EVALUATION:
1. Write a program to find the product of four numbers using the ‘LET’ statement?
2. Write a program to calculate the average of five numbers using the ‘INPUT’ statement?