SlideShare a Scribd company logo
PROGRAM LOGIC AND FORMULATION
GENERATIONS OF COMPUTER
 ABACUS - Developed around 300 years
BC by the Mesopotamians and later
improved by Chinese.
 An abacus consists of beads divided into
two parts which are movable on the rods of
the two parts.

FIRST GENERATION COMPUTER (1940 - 1956)
Vacuum Tubes
 ENIAC (Electronic numerical Integrated And
Computer).
 Developed by Presper Eckert and John Mauchly ,
ENIAC was made up of 18,000 vacuum tubes and
occupied a 30 x 50 feet room.
 Programming was done by plugging wires into a
patch panel.
KEY FEATURES :
Big and Clumsy Computers
that used Vacuum Tubes.
Not very reliable as Electric
failure occurred regularly.
Large air Conditioners were
necessary because the
computers Generated lot of
heat.
Used stored program
concept.
Input and Output Devices :
Either No Input Devices
REMARKS :
Very large space requirement.
High electricity consumption.
Generated lot of heat.
Slow operating speed.
Restricted computing
capacity.
Limited Programming
capabilities.
Memory Type : Magnetic Drums
Storage: Punched Cards and
PROGRAM LOGIC AND FORMULATION
PROGRAM LOGIC AND FORMULATION
FIRST GENERATION COMPUTER (1940 - 1956)
Vacuum Tubes
 Trajectory tables for weapons. (too late for war
effort).
 Programmed manually by Switches.
 18,000 vacuum tubes.
 30 tons
 15,000 square feet
 140 kW power consumption
 5,000 additions per second.
DISADVANTAGES:
1. They were to bulky.
2. They emitted large amounts of heat because they
used lots of vacuum tubes.
3. AIR conditioning was required.
4. They were Prone to frequent that’s why they were
unreliable.
SECOND GENERATION COMPUTER(1956 - 1963)
Transistors
 The creation of transistor sparked the production of
a wave of second generation computer. Transistor
was a small device used to transfer the electronic
signals across a resistor. Transistors had many
advantages compared to vacuum tubes.KEY FEATURES :
Transistors replaced vacuum
tubes.
Smaller in size compared to
1st generation computers.
Generated lesser heat than
earlier computer.
Low electricity consumption.
More reliable and faster.
Input Devices and Output
Devices : Punched Cards.
REMARKS :
Not General – purpose
computers – mostly suitable to
scientific and bulk data
processing tasks only; not for
business purposes.
The machines were costly
Frequent Maintenance
required. .
PROGRAM LOGIC AND FORMULATION
PROGRAM LOGIC AND FORMULATION
THIRD GENERATION COMPUTER(1964 - 1971)
Integrated Circuits
 The development of integrated circuits (IC) in 1961,
signaled the beginning of the third generation
computers and the integrated circuit technology,
which had reduced the size and cost of computers
enormously.
 It is also known as Semiconductor.
KEY FEATURES :
Integrated Circuits
Computers Smaller , faster
and more reliable.
Lower power consumption
High level languages
developed
Input and Devices : Keyboards
and printers.
REMARKS :
Proved to be highly reliable ,
relatively , inexpensive, and
faster.
Less human labour was
required at assembly stage.
PROGRAM LOGIC AND FORMULATION
PROGRAM LOGIC AND FORMULATION
FOURTH GENERATION COMPUTER(1971 - Present)
Microprocessors
 In 1971 Intel Created the first microprocessor and
the era of fourth generation computers started.
 During the fourth generation, hardware technology
such as silicone chips, microprocessors, and
storage devices were invented.
 Microprocessor is developed for computer memory
and logic.
KEY FEATURES :
Portable Computers
developed.
Great Development in data
communication.
Input and Devices : Keyboard,
mouse, joysticks , speakers etc.
REMARKS :
Computers costs came down
so rapidly that these found
places at most offices and
homes.
Smaller and faster
More speed , Reliability and
Storage Capacity.
Personal software Industry
Boomed.
Memory : Memory Chips
SOFTWARE
LESSON 2 All computer programs or routines that
control the function of hardware and affect
data are referred to as SOFTWARE.
 Software is a set of electronic instructions
consisting of complex codes (also known as
programs) that make the computer perform
tasks.
 Software tells the computer what to do.
 There are two major categories of computer
software :
System software & Application Software.
Systems software
 System software exists primarily for the
computer’s use and helps the computer
perform and manage its own task.
 One major type of the systems software, the
operating system, (tells the computer how
to use its own components.)
 Examples of operating systems include
Windows 98, Windows XP , Mac OS, Linux,
UNIX, OS/2 and DOS.
Applications
software On the other hand are types of programs
that exist primarily for the use and enable
the computer to perform tasks.
 Application software tells the computer how
to accomplish specific tasks, such as world
processing or drawing, for the user.
 Examples of popular application programs
are Microsoft Word, Adobe Photoshop,
AutoCAD, and Netscape Navigator.
PEOPLE
 People are the computer operators,
also known as users.
 Some computer systems are complete
without a person’s involvement;
however
 No computer is totally autonomous.
Even if a computer can do its job
without a person sitting in front of it,
people still building , program , and
repair computer systems.
data
 Data are raw facts that a computer stores and
reads in the form of numbers.
 The computer manipulates data according to the
instructions contained in the software and then
forwards it for use by people or another computer.
 Data can be letters, numbers, sounds, or images.
 No matter what kind of data is entered into a
computer, however, the computer converts it to
numbers. Because of this , computerized data is
digital, meaning that it has been reduced or
represented by digits, or numbers.
How computers represent
data Computers represent data as numbers. Numbers
, letters, punctuation marks, sounds and
pictures are numbers. Even instructions
performed by the computer are numbers.
 People use base 10 to represent numbers. The
system is called base 10 or the decimal number
system because ten symbols are available: 0, 1 ,2
,3, 4, 5, 6, 7, 8, 9.
 When you need to represent number greater than
9, you use two symbols together , as in (e.g. 9 + 1
= 10.) Each symbol in a number is called a digit, so
10 is a two-digit number.
How computers represent
data A computer, however, can only represent data by
the state of its electrical switches. A switch can only
have two possible states – on and off – so it can
represent only two numeric values. To a computer,
when a switch is off, it represents a 0; when a
switch is on, it represents a 1. because there are
only two values, computers are said to function in
base 2, which is also known as the binary number
system.
 When a computer needs to represent a quantity
greater than 1m it does the same thing to represent
a quantity greater than 9: it uses two or more digits.
How computers represent
data Base 10 Base 2
0 0
1 1
2 10
3 11
4 100
5 101
6 110
7 111
8 1000
9 1001
10 1010
PROGRAM LOGIC AND FORMULATION
The computer program
LESSON 3 What is a computer program?
 A computer program is a set of
statements or instructions to be fed to
the computer to solve a
computer/computing problem.
 These instructions are given and set
by a programmer.
Character set
LESSON 3 Character set are set of symbols used in the
computer.
 Character set has different types which include
data character set, arithmetic operators,
conditional operators, and punctuation
characters.
 DATA CHARACTER SET
 Data character set is made up of characters
used as data. It is composed of the ff.:
 Special Characters ( @ # $ % ^ & etc.)
 Numeric Characters ( 0 to 9 )
 Alphabetic Characters ( A to Z )
Character set
LESSON 3 ARITHMETIC OPERATORS
 Arithmetic operators are operators used to
perform certain arithmetic operations. Here are
the following arithmetic operators.
Symbol Operation
+ Addition
- Subtraction
* Multiplication
/ Division
^ Exponential
 Integer Division(returns only the whole
part)
MOD Modulo Division (returns the remainder)
Character set
LESSON 3 CONDITIONAL OPERATORS
 Used in conditional instructions. Here are the ff.:
Symbol Operation
= Equal to
< Less than
<= Less than equal to
> Greater than
>= Greater than equal to
<> Or >< Not equal
Character set
LESSON 3 PUNCTUATION CHARACTERS
 Are characters that have a special purpose.
Here are examples of punctuation character
and their purpose.
Symbol Use
: (colon) used after procedure labels
, (comma) used to separate enumerations
; (semi-colon) used to terminate
instruction
“ (quote) used to enclose string constrain,
i.e., “Hello World”
‘ (apostrophe) used to enclose single
character, i.e., ‘a’
Data types
LESSON 3 Information can be classified through Data Types.
Here are some of the data type and their
characteristics.
Data Type Description
Numeric Any information that is composed of numbers
Character Any information composed of singles character
enclosed with apostrophe
Date or Time Any information that indicates Data or Time
String Any information composed of any number of
characters enclosed with quotes
Constant
LESSON 3 Constant is a quantity or values which does not
change.
 Numeric Constants – any signed or unsigned
numeric value in form of:
 Integer (i.e., 1, -1, +1)
 Fraction (i.e. 1.0, -1.2, +0.12)
 Exponentiation (i.e. 2^2)
 Non-numeric or String Constants – any
combination of characters that is enclosed in pair of
quotes.
 It consists of any combination of characters. Special
characters are also included.
 The characters are enclosed in a pair of quotes.
 It can accommodate any number of characters.
Variable
LESSON 3 Variable is a name or symbol that is used as
reference for a value.
 Rules in using variable
 The first letter of the variable name should be any
letter.
 If you will use dash(-), it should be embedded. (i.e.
Student-No)
 It can accommodate any number of characters
 String variable – a variable that stores
string data type. (i.e. FirstName, Address,
StudentNo)
 Numeric Variable – a variable that stores
numeric data type (i.e. Age, Counter,
Amount)
exercises
 Given the following data types (numeric , date or
time, string, and character). Identify the following
information.
1. ‘c’
2. “my name is rain”
3. 12/20/1979
4. “1234”
5. 1234
6. July 17, 1980
7. ‘g’
8. “December 20, 1979”
9. 1.25
10.8
OPERATIONS
LESSON 4 There are different kinds of operation
that are being used in a computer
program. They are as follows :
 Move Operation
 Arithmetic Operation
 Conditional Operation
OPERATIONS
LESSON 4 MOVE OPERATION
 Move operation causes the value of
variable to change. The operator used
in this operation is “=”
 Example :
StudentName = “Gladys Ordanel”
Age = 15
Amount = 5.00
OPERATIONS
LESSON 4 ARITHMETIC OPERATION
 Arithmetic operation is the evaluation
of arithmetic expression.
 Here is an example of an Arithmetic
Expression : 1 + 2 + 3 3 * 4
^ 5 (Age * 6 ) ^ 7
 Hierarchy of Arithmetic Operation
 In Arithmetic Operation there is a
structure to be followed to know which
arithmetic operation will be resolved
first.
OPERATIONS
LESSON 4 Here is the hierarchy to be followed
in Arithmetic Operation
1. Expression inside the parenthesis
2. Exponentiation
3. Multiplication and division. (from left
to right)
4. Integer division
5. Modulo division
6. Addition and subtraction. ( from left
to right)
OPERATIONS
LESSON 4 Example: Evaluate the following
expressions
1. 2 * 2 – 6 / 3
= 4 - 2
= 2
2. 2 * 6 ^ 2 – 20 / 5
= 2 * 36 – 4
= 72 – 4
= 68
3 * (4 + 2) / 2
= 3 * 6 / 2
= 18 / 2
= 9
4. (3 - 2) * 10 MOD 3
= 1 * 10 MOD 3
= 10 MOD 3
= 1
5. 7  (3 - 2) ^ 100 MOD 2 * 8
= 7  1 ^ 100 MOD 16
= 7  1 MOD 16
= 7
OPERATIONS
LESSON 4 CONDITIONAL OPERATION
 Conditional Operation is the resolution of
logical expression that arrives on a single
value either TRUE or FALSE.
 As addition to operators, here is the logical
operator, its symbol and description.
Symbol Description
AND / OR Binary Operators (Two Operands)
NOT Unary Operator (Single Operand)
OPERATIONS
LESSON 4 HIERARCHY OF CONDITIONAL
OPERATION
 Like the Arithmetic Operation, Conditional
Operation also has a hierarchy to know
which conditional operation will be resolved
first.
 Here is the hierarchy to be followed in
Conditional Operation
1. Expression inside the parenthesis
2. NOT operator
3. AND operator
4. OR operator
OPERATIONS
LESSON 4 Here is the table on how logical
operators generate results.
Logical AND Operator
Expr1 Expr2 Result
True True True
False True False
True False False
False False False
Logical OR Operator
Expr1 Expr2 Result
True True True
False True True
True False True
False False False
Logical NOT Operator
Expression Result
NOT True False
NOT False True
OPERATIONS
LESSON 4 Example: Evaluate the following
expressions
1. T AND T OR F AND F
= T OR F
= T
2. (F OR F) AND NOT (T AND T)
= F AND F
= F
3. F AND NOT T OR T AND NOT F
= F AND F OR T AND T
= F OR T
= T
OPERATIONS
LESSON 4 COUNTER
 Counter is a data storage used for counting.
Usually the incremental value for a counter
is 1. (e.g. ctr = ctr + 1)
 ACCUMULATOR
 Like a counter, an accumulator is also data
storage for counting but its incremental
value varies and can be stored in to a
variable. (e.g. acc = acc + var)
Exercises lesson
4 Evaluate the following arithmetic expression.
1. ( 8 / 2 ) ^ 2
2. 8 / 2 ^ 2
3. 6 + 2 – 3
4. 6 / 2 * 3
5. 2 * (2 + 3)
^ 2
 Evaluate the following conditional expression.
1. NOT T AND T.
2. NOT T OR T
3. (T OR T) AND F
4. NOT (F AND T ) AND F
5. F AND F OR T AND NOT (F AND T)
PROGRAM LOGIC AND FORMULATION
Pseudo-CODE
LESSON 2

More Related Content

PPT
Lecture#2 Computer languages computer system and Programming EC-105
PPT
C++ programming program design including data structures
PPTX
Intro To C++ - Class 11 - Converting between types, formatting floating point...
PPTX
C++ AND CATEGORIES OF SOFTWARE
PPT
Program Logic Formulation - Ohio State University
PPTX
Class 2 variables, classes methods...
PPTX
Programming the basic computer
PPTX
C++ PROGRAMMING BASICS
Lecture#2 Computer languages computer system and Programming EC-105
C++ programming program design including data structures
Intro To C++ - Class 11 - Converting between types, formatting floating point...
C++ AND CATEGORIES OF SOFTWARE
Program Logic Formulation - Ohio State University
Class 2 variables, classes methods...
Programming the basic computer
C++ PROGRAMMING BASICS

What's hot (19)

ODP
(2) cpp imperative programming
PDF
Cse115 lecture03problemsolving
PPT
Computer Programming - Lecture 2
PPT
Basics of c++
PDF
Algorithm and c language
PDF
Ge6161 lab manual
PPTX
Digital Logic Design Lecture 01
PPTX
C basics
PDF
Cse115 lecture04introtoc programming
PPT
1 Revision Tour
PPT
c-programming
PPTX
C++ Programming Language Training in Ambala ! Batra Computer Centre
PDF
Assignment9
DOCX
CLASS VIII COMPUTERS FLOW CHART AND ALGORITHM
PPTX
Cs1123 3 c++ overview
PDF
PPT
C++ Language
PPT
8.2 approach in problem solving (9 hour)
(2) cpp imperative programming
Cse115 lecture03problemsolving
Computer Programming - Lecture 2
Basics of c++
Algorithm and c language
Ge6161 lab manual
Digital Logic Design Lecture 01
C basics
Cse115 lecture04introtoc programming
1 Revision Tour
c-programming
C++ Programming Language Training in Ambala ! Batra Computer Centre
Assignment9
CLASS VIII COMPUTERS FLOW CHART AND ALGORITHM
Cs1123 3 c++ overview
C++ Language
8.2 approach in problem solving (9 hour)
Ad

Similar to PROGRAM LOGIC AND FORMULATION (20)

DOCX
Generation of Computer Network
PPTX
Computer basics Intro
PPTX
Computer fundamentals
PPTX
PPTX
Computer Organization and Architecture ppt .pptx
PPTX
INTRODUCTION TO COMPUTING OR FUNDAMENTAL COMPUTING
PDF
It tools and buisness system.docx
PDF
Basics of computer and Number conversions.pdf
DOCX
Information technology
DOCX
introduction to it
PPT
Computer fundamentals
PPT
Introduction to computers
PPTX
Introduction to computer hardware
PPT
System concept and hardware
PPTX
The Computer use in our modern lives .pptx
PPTX
Computer Science | Fundaments of Computer
PPTX
intorudction to the coa in the computer systems
PPTX
Fundamentals of computers & information system
PDF
PDF
Computer application
Generation of Computer Network
Computer basics Intro
Computer fundamentals
Computer Organization and Architecture ppt .pptx
INTRODUCTION TO COMPUTING OR FUNDAMENTAL COMPUTING
It tools and buisness system.docx
Basics of computer and Number conversions.pdf
Information technology
introduction to it
Computer fundamentals
Introduction to computers
Introduction to computer hardware
System concept and hardware
The Computer use in our modern lives .pptx
Computer Science | Fundaments of Computer
intorudction to the coa in the computer systems
Fundamentals of computers & information system
Computer application
Ad

Recently uploaded (20)

PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Encapsulation theory and applications.pdf
PDF
KodekX | Application Modernization Development
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Big Data Technologies - Introduction.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
cuic standard and advanced reporting.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Electronic commerce courselecture one. Pdf
PPTX
sap open course for s4hana steps from ECC to s4
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPT
Teaching material agriculture food technology
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Encapsulation theory and applications.pdf
KodekX | Application Modernization Development
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Big Data Technologies - Introduction.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
cuic standard and advanced reporting.pdf
Encapsulation_ Review paper, used for researhc scholars
Chapter 3 Spatial Domain Image Processing.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Electronic commerce courselecture one. Pdf
sap open course for s4hana steps from ECC to s4
The AUB Centre for AI in Media Proposal.docx
20250228 LYD VKU AI Blended-Learning.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Teaching material agriculture food technology
Mobile App Security Testing_ A Comprehensive Guide.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx

PROGRAM LOGIC AND FORMULATION

  • 2. GENERATIONS OF COMPUTER  ABACUS - Developed around 300 years BC by the Mesopotamians and later improved by Chinese.  An abacus consists of beads divided into two parts which are movable on the rods of the two parts. 
  • 3. FIRST GENERATION COMPUTER (1940 - 1956) Vacuum Tubes  ENIAC (Electronic numerical Integrated And Computer).  Developed by Presper Eckert and John Mauchly , ENIAC was made up of 18,000 vacuum tubes and occupied a 30 x 50 feet room.  Programming was done by plugging wires into a patch panel. KEY FEATURES : Big and Clumsy Computers that used Vacuum Tubes. Not very reliable as Electric failure occurred regularly. Large air Conditioners were necessary because the computers Generated lot of heat. Used stored program concept. Input and Output Devices : Either No Input Devices REMARKS : Very large space requirement. High electricity consumption. Generated lot of heat. Slow operating speed. Restricted computing capacity. Limited Programming capabilities. Memory Type : Magnetic Drums Storage: Punched Cards and
  • 6. FIRST GENERATION COMPUTER (1940 - 1956) Vacuum Tubes  Trajectory tables for weapons. (too late for war effort).  Programmed manually by Switches.  18,000 vacuum tubes.  30 tons  15,000 square feet  140 kW power consumption  5,000 additions per second. DISADVANTAGES: 1. They were to bulky. 2. They emitted large amounts of heat because they used lots of vacuum tubes. 3. AIR conditioning was required. 4. They were Prone to frequent that’s why they were unreliable.
  • 7. SECOND GENERATION COMPUTER(1956 - 1963) Transistors  The creation of transistor sparked the production of a wave of second generation computer. Transistor was a small device used to transfer the electronic signals across a resistor. Transistors had many advantages compared to vacuum tubes.KEY FEATURES : Transistors replaced vacuum tubes. Smaller in size compared to 1st generation computers. Generated lesser heat than earlier computer. Low electricity consumption. More reliable and faster. Input Devices and Output Devices : Punched Cards. REMARKS : Not General – purpose computers – mostly suitable to scientific and bulk data processing tasks only; not for business purposes. The machines were costly Frequent Maintenance required. .
  • 10. THIRD GENERATION COMPUTER(1964 - 1971) Integrated Circuits  The development of integrated circuits (IC) in 1961, signaled the beginning of the third generation computers and the integrated circuit technology, which had reduced the size and cost of computers enormously.  It is also known as Semiconductor. KEY FEATURES : Integrated Circuits Computers Smaller , faster and more reliable. Lower power consumption High level languages developed Input and Devices : Keyboards and printers. REMARKS : Proved to be highly reliable , relatively , inexpensive, and faster. Less human labour was required at assembly stage.
  • 13. FOURTH GENERATION COMPUTER(1971 - Present) Microprocessors  In 1971 Intel Created the first microprocessor and the era of fourth generation computers started.  During the fourth generation, hardware technology such as silicone chips, microprocessors, and storage devices were invented.  Microprocessor is developed for computer memory and logic. KEY FEATURES : Portable Computers developed. Great Development in data communication. Input and Devices : Keyboard, mouse, joysticks , speakers etc. REMARKS : Computers costs came down so rapidly that these found places at most offices and homes. Smaller and faster More speed , Reliability and Storage Capacity. Personal software Industry Boomed. Memory : Memory Chips
  • 14. SOFTWARE LESSON 2 All computer programs or routines that control the function of hardware and affect data are referred to as SOFTWARE.  Software is a set of electronic instructions consisting of complex codes (also known as programs) that make the computer perform tasks.  Software tells the computer what to do.  There are two major categories of computer software : System software & Application Software.
  • 15. Systems software  System software exists primarily for the computer’s use and helps the computer perform and manage its own task.  One major type of the systems software, the operating system, (tells the computer how to use its own components.)  Examples of operating systems include Windows 98, Windows XP , Mac OS, Linux, UNIX, OS/2 and DOS.
  • 16. Applications software On the other hand are types of programs that exist primarily for the use and enable the computer to perform tasks.  Application software tells the computer how to accomplish specific tasks, such as world processing or drawing, for the user.  Examples of popular application programs are Microsoft Word, Adobe Photoshop, AutoCAD, and Netscape Navigator.
  • 17. PEOPLE  People are the computer operators, also known as users.  Some computer systems are complete without a person’s involvement; however  No computer is totally autonomous. Even if a computer can do its job without a person sitting in front of it, people still building , program , and repair computer systems.
  • 18. data  Data are raw facts that a computer stores and reads in the form of numbers.  The computer manipulates data according to the instructions contained in the software and then forwards it for use by people or another computer.  Data can be letters, numbers, sounds, or images.  No matter what kind of data is entered into a computer, however, the computer converts it to numbers. Because of this , computerized data is digital, meaning that it has been reduced or represented by digits, or numbers.
  • 19. How computers represent data Computers represent data as numbers. Numbers , letters, punctuation marks, sounds and pictures are numbers. Even instructions performed by the computer are numbers.  People use base 10 to represent numbers. The system is called base 10 or the decimal number system because ten symbols are available: 0, 1 ,2 ,3, 4, 5, 6, 7, 8, 9.  When you need to represent number greater than 9, you use two symbols together , as in (e.g. 9 + 1 = 10.) Each symbol in a number is called a digit, so 10 is a two-digit number.
  • 20. How computers represent data A computer, however, can only represent data by the state of its electrical switches. A switch can only have two possible states – on and off – so it can represent only two numeric values. To a computer, when a switch is off, it represents a 0; when a switch is on, it represents a 1. because there are only two values, computers are said to function in base 2, which is also known as the binary number system.  When a computer needs to represent a quantity greater than 1m it does the same thing to represent a quantity greater than 9: it uses two or more digits.
  • 21. How computers represent data Base 10 Base 2 0 0 1 1 2 10 3 11 4 100 5 101 6 110 7 111 8 1000 9 1001 10 1010
  • 23. The computer program LESSON 3 What is a computer program?  A computer program is a set of statements or instructions to be fed to the computer to solve a computer/computing problem.  These instructions are given and set by a programmer.
  • 24. Character set LESSON 3 Character set are set of symbols used in the computer.  Character set has different types which include data character set, arithmetic operators, conditional operators, and punctuation characters.  DATA CHARACTER SET  Data character set is made up of characters used as data. It is composed of the ff.:  Special Characters ( @ # $ % ^ & etc.)  Numeric Characters ( 0 to 9 )  Alphabetic Characters ( A to Z )
  • 25. Character set LESSON 3 ARITHMETIC OPERATORS  Arithmetic operators are operators used to perform certain arithmetic operations. Here are the following arithmetic operators. Symbol Operation + Addition - Subtraction * Multiplication / Division ^ Exponential Integer Division(returns only the whole part) MOD Modulo Division (returns the remainder)
  • 26. Character set LESSON 3 CONDITIONAL OPERATORS  Used in conditional instructions. Here are the ff.: Symbol Operation = Equal to < Less than <= Less than equal to > Greater than >= Greater than equal to <> Or >< Not equal
  • 27. Character set LESSON 3 PUNCTUATION CHARACTERS  Are characters that have a special purpose. Here are examples of punctuation character and their purpose. Symbol Use : (colon) used after procedure labels , (comma) used to separate enumerations ; (semi-colon) used to terminate instruction “ (quote) used to enclose string constrain, i.e., “Hello World” ‘ (apostrophe) used to enclose single character, i.e., ‘a’
  • 28. Data types LESSON 3 Information can be classified through Data Types. Here are some of the data type and their characteristics. Data Type Description Numeric Any information that is composed of numbers Character Any information composed of singles character enclosed with apostrophe Date or Time Any information that indicates Data or Time String Any information composed of any number of characters enclosed with quotes
  • 29. Constant LESSON 3 Constant is a quantity or values which does not change.  Numeric Constants – any signed or unsigned numeric value in form of:  Integer (i.e., 1, -1, +1)  Fraction (i.e. 1.0, -1.2, +0.12)  Exponentiation (i.e. 2^2)  Non-numeric or String Constants – any combination of characters that is enclosed in pair of quotes.  It consists of any combination of characters. Special characters are also included.  The characters are enclosed in a pair of quotes.  It can accommodate any number of characters.
  • 30. Variable LESSON 3 Variable is a name or symbol that is used as reference for a value.  Rules in using variable  The first letter of the variable name should be any letter.  If you will use dash(-), it should be embedded. (i.e. Student-No)  It can accommodate any number of characters  String variable – a variable that stores string data type. (i.e. FirstName, Address, StudentNo)  Numeric Variable – a variable that stores numeric data type (i.e. Age, Counter, Amount)
  • 31. exercises  Given the following data types (numeric , date or time, string, and character). Identify the following information. 1. ‘c’ 2. “my name is rain” 3. 12/20/1979 4. “1234” 5. 1234 6. July 17, 1980 7. ‘g’ 8. “December 20, 1979” 9. 1.25 10.8
  • 32. OPERATIONS LESSON 4 There are different kinds of operation that are being used in a computer program. They are as follows :  Move Operation  Arithmetic Operation  Conditional Operation
  • 33. OPERATIONS LESSON 4 MOVE OPERATION  Move operation causes the value of variable to change. The operator used in this operation is “=”  Example : StudentName = “Gladys Ordanel” Age = 15 Amount = 5.00
  • 34. OPERATIONS LESSON 4 ARITHMETIC OPERATION  Arithmetic operation is the evaluation of arithmetic expression.  Here is an example of an Arithmetic Expression : 1 + 2 + 3 3 * 4 ^ 5 (Age * 6 ) ^ 7  Hierarchy of Arithmetic Operation  In Arithmetic Operation there is a structure to be followed to know which arithmetic operation will be resolved first.
  • 35. OPERATIONS LESSON 4 Here is the hierarchy to be followed in Arithmetic Operation 1. Expression inside the parenthesis 2. Exponentiation 3. Multiplication and division. (from left to right) 4. Integer division 5. Modulo division 6. Addition and subtraction. ( from left to right)
  • 36. OPERATIONS LESSON 4 Example: Evaluate the following expressions 1. 2 * 2 – 6 / 3 = 4 - 2 = 2 2. 2 * 6 ^ 2 – 20 / 5 = 2 * 36 – 4 = 72 – 4 = 68 3 * (4 + 2) / 2 = 3 * 6 / 2 = 18 / 2 = 9 4. (3 - 2) * 10 MOD 3 = 1 * 10 MOD 3 = 10 MOD 3 = 1 5. 7 (3 - 2) ^ 100 MOD 2 * 8 = 7 1 ^ 100 MOD 16 = 7 1 MOD 16 = 7
  • 37. OPERATIONS LESSON 4 CONDITIONAL OPERATION  Conditional Operation is the resolution of logical expression that arrives on a single value either TRUE or FALSE.  As addition to operators, here is the logical operator, its symbol and description. Symbol Description AND / OR Binary Operators (Two Operands) NOT Unary Operator (Single Operand)
  • 38. OPERATIONS LESSON 4 HIERARCHY OF CONDITIONAL OPERATION  Like the Arithmetic Operation, Conditional Operation also has a hierarchy to know which conditional operation will be resolved first.  Here is the hierarchy to be followed in Conditional Operation 1. Expression inside the parenthesis 2. NOT operator 3. AND operator 4. OR operator
  • 39. OPERATIONS LESSON 4 Here is the table on how logical operators generate results. Logical AND Operator Expr1 Expr2 Result True True True False True False True False False False False False Logical OR Operator Expr1 Expr2 Result True True True False True True True False True False False False Logical NOT Operator Expression Result NOT True False NOT False True
  • 40. OPERATIONS LESSON 4 Example: Evaluate the following expressions 1. T AND T OR F AND F = T OR F = T 2. (F OR F) AND NOT (T AND T) = F AND F = F 3. F AND NOT T OR T AND NOT F = F AND F OR T AND T = F OR T = T
  • 41. OPERATIONS LESSON 4 COUNTER  Counter is a data storage used for counting. Usually the incremental value for a counter is 1. (e.g. ctr = ctr + 1)  ACCUMULATOR  Like a counter, an accumulator is also data storage for counting but its incremental value varies and can be stored in to a variable. (e.g. acc = acc + var)
  • 42. Exercises lesson 4 Evaluate the following arithmetic expression. 1. ( 8 / 2 ) ^ 2 2. 8 / 2 ^ 2 3. 6 + 2 – 3 4. 6 / 2 * 3 5. 2 * (2 + 3) ^ 2  Evaluate the following conditional expression. 1. NOT T AND T. 2. NOT T OR T 3. (T OR T) AND F 4. NOT (F AND T ) AND F 5. F AND F OR T AND NOT (F AND T)