0% found this document useful (0 votes)
5 views7 pages

Computer Programming and Problem Solving

The document provides an overview of fundamental concepts in computer programming and problem solving, including algorithms, flowcharts, pseudo code, control structures, databases, programming languages, and the roles of compilers and interpreters. It includes examples and explanations of each concept to aid understanding for preparatory year unit students at Prince Sattam bin Abdulaziz University. Key topics covered include the step-by-step procedures for problem-solving and the differences between various programming tools.

Uploaded by

42hdtzwx5r
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views7 pages

Computer Programming and Problem Solving

The document provides an overview of fundamental concepts in computer programming and problem solving, including algorithms, flowcharts, pseudo code, control structures, databases, programming languages, and the roles of compilers and interpreters. It includes examples and explanations of each concept to aid understanding for preparatory year unit students at Prince Sattam bin Abdulaziz University. Key topics covered include the step-by-step procedures for problem-solving and the differences between various programming tools.

Uploaded by

42hdtzwx5r
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Prince Sattam bin Abdulaziz University

Preparatory Year Unit

Fundamentals of Computer
Programming and Problem Solving
[Information Technology]

Extra Material
Fundamentals of Computer Programming and Problem Solving

Table of contents Page

1. Introduction 2

2. Algorithm 2

3. Flow chart 2

4. Pseudo Code 3

5. Control Structure 4

6. Database and database management system 6

7. Programming languages 6

8. Compiler and interpreter 6

Content Recommended For Preparatory Year Unit Students PSAU |Page1


Introduction:
To solve any programming problem, use the following:
1. Algorithms
2. Flowcharts
3. Pseudo code

1. ALGORITHM
An algorithm is a step-by-step procedure used for solving a problem or performing a
computation.

Example 1.1
Algorithm for addition of two numbers
Step1: Start

Step 2: Input A, B

Step 3: Calculate C=A+B

Step 4: Output C

Step 5: Stop

2. FLOW CHART
Flowchart is a diagrammatic way of representing an algorithm.
Symbols used in a flow chart:

Symbol Name Functions


Oval Start/Stop

Parallelogram Input/output

Rectangle Processing

Diamond Decision Making

Circle Connector

Flow lines Control Flow

Content Recommended For Preparatory Year Unit Students PSAU |Page2


Example 2.1
Flow chart for addition of two numbers

Start

Input A, B

C=A+B

Print C

Stop

3. PSEUDO CODE: a description of what a computer program or algorithm must do,


expressed in a formally styled natural language rather than in a programming
language.

Example 3.1: Pseudo Code for Addition of two Numbers

Start
Input a
Input b
Sum = a+b
Output sum
Stop

Content Recommended For Preparatory Year Unit Students PSAU |Page3


4. CONTROL STRUCTURES
A control structure is a block of programming that analyzes variables and chooses a
direction in which to go based on given parameters.

It has two type


1. Branching (Branching is a decision - what actions to take.)
2. Looping (Looping is a decision - how many times to take a certain action.)

4.1 Example of Branching:


Algorithm and flow chart for greatest of two numbers.

a. ALGORITHM:

Step 1: Start
Step 2: Input the values of A, B
Step 3: If A > B then go to step 5
Step 4: Print “B is largest” go to Step 6
Step 5: Print “A is largest”
Step 6: Stop

b. FLOW CHART:

Start

Input A, B

True False
A>B

Print B
Print A bA

Stop

Content Recommended For Preparatory Year Unit Students PSAU |Page4


3.2 Example of Looping:

Algorithm and flow chart for display of first 5 natural numbers using control structure while.

a. ALGORITHM:

Step 1: Start

Step 2: Set i= 1

Step 3: Repeat the following until i<= 5

3.1: Output i

3.2: i = i+1

Step 4: Stop

b. FLOW CHART:

Start

i=1

False
i <= 5

True
Stop

Print i

i= i + 1

Content Recommended For Preparatory Year Unit Students PSAU |Page5


5. DATABASE AND DATABASE MANAGEMENT SYSTEM
5.1 Database: Database is an organized collection of related data stored electronically in a
computer system.
Example: Student database

5.2 Database Management System:


A database management system is a software designed to help in maintaining organizing
and utilizing a database.
6. PROGRAMMING LANGUAGE
A programming language is a type of written language that tells computers what to do.
Examples are: Python, Ruby, Java, JavaScript, C, C++, and C#.
Programming languages are used to write all computer programs and computer software

7. COMPILER AND INTERPRETER

7.1 Compiler:
Compiler is a program that translates a high-level language into machine level language.

7.2 Interpreter:
Interpreter is a program that translates a high-level language into machine level language line by line.

7.3 Comparison between Compiler and interpreter

# Compiler Interpreter

Compiler Takes Entire program as input Interpreter Takes Single instruction as input.
1
Program execution is fast Program execution is relatively slow
2
Example: C Compiler Example: BASIC
3

Content Recommended For Preparatory Year Unit Students PSAU |Page6

You might also like