Introduction to
Programing
Introduction
Salem Belgurzi
Topics
• Introduction
• Hardware and Software
• How Computers Store Data
• How a Program Works
• Flowcharts
Introduction
• Computers can be programmed
• Designed to do any job that a program tells them to
• Program: set of instructions that a computer
follows to perform a task
• Commonly referred to as Software
• Programmer: person who can design, create, and
test computer programs
• Also known as software developer
Hardware and Software
• Hardware: The physical devices that make up a
computer
• Computer is a system composed of several components that
all work together
• Typical major components:
• Central processing unit
• Main memory
• Secondary storage devices
• Input and output devices
How Computers Store Data
• All data in a computer is stored in sequences of 0s
and 1s
• Byte: just enough memory to store letter or small
number
• Divided into eight bits
• Bit: electrical component that can hold positive or negative
charge, like on/off switch
• The on/off pattern of bits in a byte represents data stored in
the byte
How a Program Works
• Program must be copied from secondary memory
to RAM each time CPU executes it
• CPU executes program in cycle:
• Fetch: read the next instruction from memory into CPU
• Decode: CPU decodes fetched instruction to determine
which operation to perform
• Execute: perform the operation
From Machine Language to Assembly
Language
• Impractical for people to write in machine language
• Assembly language: uses short words
(mnemonics) for instructions instead of binary
numbers
• Easier for programmers to work with
• Assembler: translates assembly language to
machine language for execution by CPU
High-Level Languages
• Low-level language: close in nature to machine
language
• Example: assembly language
• High-Level language: allows simple creation of
powerful and complex programs
• No need to know how CPU works or write large number of
instructions
• More intuitive to understand
Compilers
• Programs written in high-level languages must be
translated into machine language to be executed
• Compiler: translates high-level language program
into separate machine language program
• Machine language program can be executed at any time.
• Source code: statements written by programmer
• Syntax error: prevents code from being translated
Flowcharts
Type of diagram that represents a workflow or process
A graphical or symbolic representation of a process, where each
step is represented by a different symbol and contains a short
description of the process step
Used to design, document, analyze, manage, and communicate
processes or programs
Flowcharts – Logic Symbols
Flowcharts – Logic Symbols
Flowcharts – Sample Flow
Rules For Creating a Flowcharts
Flowchart is the visual representation of an algorithm or a process.
Rule 1: Flowchart opening statement must be ‘start’ keyword.
Rule 2: Flowchart ending statement must be ‘end’ keyword.
• Rule 3: All symbols in the flowchart must be connected with an arrow line.
• Rule 4: Each decision point should have two or more distinct outcomes.
• Rule 5: Flow should generally move from top to bottom or left to right.
Example of a Flowcharts
Draw a flowchart to input two numbers from the user and display
the largest of two numbers.
Example of a Flowcharts
Example of a Flowcharts
Find the largest among three different numbers entered by the
user.
Example of a Flowcharts
Using C#
• C# (pronounced "C-sharp") is a modern, versatile,
object-oriented programming language developed
by Microsoft.
• C# is used to develop web apps, desktop apps,
mobile apps, database applications, games and
much more.
C# Example
Recently IEEE Spectrum came with the ranking sheet
of the most popular programming languages in 2024.