0% found this document useful (0 votes)
7 views

Programming I

The document discusses the basics of computer programming including what programming is, the general phases of programming, pseudocode, variables, input, output, operations, flowcharts, and provides examples of simple programs to calculate sums and areas. Key topics covered include declaring variables, taking input, performing operations, and outputting results.

Uploaded by

cstitansol
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Programming I

The document discusses the basics of computer programming including what programming is, the general phases of programming, pseudocode, variables, input, output, operations, flowcharts, and provides examples of simple programs to calculate sums and areas. Key topics covered include declaring variables, taking input, performing operations, and outputting results.

Uploaded by

cstitansol
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

Computer

Science O.L.
(New Syllabus)

“Everybody should learn to program a computer,


because it teaches you how to think.”
- Steve Jobs
Practical

01
Programming pt.1
What is programming?
Programming is an important skill in today's
digital age

Process of communicating with computer to be


able to follow list given instruction.

When list of relevant instructions is grouped to do


specific task, it forms a program
Programmer Client

4 General phases

Design Testing

Analysis Implementation
Design
It is phase that helps making implementation
easier.
By following same programming concepts , but without
dealing with complicated syntax (code grammar)

Pseudocode Flowchart Structure Diagram


Uses English words Diagram that designs Breaking down the
and mathematical the steps of a system to many
notations to design program by using a subsystems in tree
the steps of a standard set of shape
program. symbols aa joined by
lines to show the
direction of flow.
Pseudocode
The closest design type to the real code.
By using English words.
Consists of some keywords that is used to do
specific task.

Structure

Keyword Content
OUTPUT
Screen
Keyword used to print something on screen

My name is Mohamed
Message Memory

Later

Output Message
Non-changing statement that you want it to be printed as it is. Code

OUTPUT “My name is Mohamed”


Output “whatever “

Don‘t forget the Quotations.


Quick question
Write a program that shows that message Screen
“Programming is Fun”

Programming is Fun
Code

OUTPUT “Programming is Fun”


DECLARE
Computer depends on memory in all its operation
DECLARE is a process of reserving memory for
later use through out the program
When declaring a memory it is called
By stating its name and type variable as you can never expect what is
gonna store until you assign it and it may
change through out the program
Variable name

Whole word(no sentences or spaces)


Name has always to start by
alphabet (no symbols or numbers)
It is preferable to always name the
variable meaningful name depends
on its purpose
DECLARE
Variable data type

Real Integer String Character Boolean

1.2, 1 My name, K, True/False


99.4, 78 ID91828, !,
9.0 9 192828 +,
9

You always have to assign the variable with its


appropriate data type that depends on how you
will use it.
DECLARE
Myname

DECLARE Name Type String

Screen

Code

DECLARE Myname : STRING


Myname

INPUT String

Screen
Keyword used to take entry from user and store it
in computer
INPUT is always related to DECLARE ……………I

Code

DECLARE Myname: String


INPUT Memory name
INPUT Myname
Myname

OUTPUT String

Screen
Keyword used to print something on screen

Message Memory

Output Memory
To show data that stored in specific memory. Code

DECLARE Myname: String


DECLARE Myname: String
Output Memory name
INPUT Myname
INPUT Myname

No quotations. OUTPUT Myname


Quick question
Write a program that take from user his age and Screen
Print it back in appropriate form

Code
Myname

Operations String

Screen
Computers are capable of doing any calculation.

Write the equation and assign it to a memory to ……………I

be stored.

Operation is always related to DECLARE

Code

DECLARE Myname: String


Memory name M/N Opr M/N
INPUT Myname
Operations
Result

Numbers
Integer

Result 20 + 10

NUM1 NUM2

20 10

Integer Integer

Memory

Result NUM1 + NUM2


Quick question
Create a program that take a name and a number Screen
from the user which represent your age and show
them in appropriate way
-( Name is.... age is....)
Code
Quick question
Create program that take two numbers as an Screen
input and print their sum.

Code
Quick question
Design an algorithm that inputs 4 numbers and Screen
calculate its sum

Code
Quick question
Design an algorithm that inputs from the user the length of two
sides of a rectangle and the program calculates and displays Screen
both the perimeter and area of that rectangle.
-Perimeter of Rectangle = (Length+Width) * 2
-Area of Rectangle = Length * Width

Code
Quick question
Design an algorithm that inputs from the user
Screen
height and base lengths of a triangle and calculate
its area.
Area= ½ x Base x height

Code
Flowchart
It is defined by specific shapes.
Non-declarative language.
It has a start and end point that you have to
mention.
It all about writing pseudocode line but in shapes.
Flowchart
Quick question
Create a program that take a name and a number
from the user which represent your age and show
them in appropriate way
-( Name is.... age is....)
Quick question
Create program that take two numbers as an
input and print their sum.
Quick question
Design an algorithm that inputs 4 numbers and
calculate its sum
Quick question
Design an algorithm that inputs from the user the length of two
sides of a rectangle and the program calculates and displays
both the perimeter and area of that rectangle.
-Perimeter of Rectangle = (Length+Width) * 2
-Area of Rectangle = Length * Width
Quick question
Design an algorithm that inputs from the user
height and base lengths of a triangle and calculate
its area.
Area= ½ x Base x height
Graded test
Create program that take two numbers as an
Screen
input and print their sum and their product.
Pseudocode & flowchart

Code
Next Session

Programming pt.2

HW
THANKS

You might also like