You are on page 1of 9

Shuja Chaudhry (FA22-BCE-082)

Programming fundamentals (lecture #1)

NOTES
COMPUTER
 Computational machine
 Processing device
 Process the data which is in digital language (0,1)
When someone provide data to the computer for specific task it is
firstly converted into the Digital language or a language which is
understood by the computer. For this purpose, compiler is used.

COMPILER
 Converter
 Basically an Interpreter
 Converts human language into the machine language
(Assembly language)
There are many compilers available on the internet or windows
have some of them preinstalled

CONVERTED FORM
CODE, PROGRAM COMPILER
0,1

CODE(PROGRAM)
 Set of instructions
 In program sequence matters
 Code must be in generalized form
 Processor convert assembly language to machine language

PROBLEM SOLVING
 Express the solution in term of instruction
 Method which is used to solve problem is known as algorithm

ALGORITHM
 Algorithm is a generalize procedure
 It is used for solving a particular problem
 It takes input form the user and produce output
 Algorithms of different people can be same but there will be same
result of the different algorithms
Qualities of a good Algorithm
1. Input and Output should be defined properly
2. Steps must be clear and unambiguous
3. Algorithm must be in generalized form (to the point, no
extra things which the problem does not require)
4. It should not include codes
5. Should be written in such way that it can be understood in
any computer language
6. Algorithms are used in different projects like in university
final year projects or representation of you programs so
instead of writing codes in your slides we should have an
over view in slides in form of Algorithm because the
reviewer can be anyone
FLOW CHARTS
 Flow charts are diagram which are used to represent flow
of process
 In flow chart the direction is much important. It should be
in one direction

Symbols
 Oval (Start and End)
 Parallelogram (Input and Output)
 Diamond (Decision)
 Rectangle (Processing)

What is Variable?
 Container
 Data saver
 Memory location in C
EXAMPLES

1. Write an algorithm to check whether the number is


even or odd
SOL.
 Take a number X
 Divide it by 2
 If it gives the remainder 0 (Then it is Even)
 If it gives the remainder other than 0 (Then it is odd)

2. Write an algorithm to add two numbers


SOL.
 Let two numbers x, y
 Then we add x+y
Lecture # 2

 Programming levels

 High level language (Human language)


 Low level language (Assembly language)

 High level language


o Programmer friendly
o Easier Understanding
o Compile Compulsory
Advantage:
 Portable
 Language independent
Disadvantages:
 Poor control on Hardware
Example
 C, C++, Fortran

Compiler:
 Translate statements into Assembly language. Which
are directly understood by the computer.

 Low level language


o Near to hardware (Easily understand by Hardware)
o One to one correspondence
o Symbolic names for performing various operation
Advantage:
 Optimized language (Hardware can be used more
effectively, processor cache etc.
Disadvantages:
 Not portable (because every processor has its own
Assembly language)

Types:
1. Assembly language
2. Machine language
 Operating System
 Layers of Software
 Important to interact with the hardware
 Controls all operation
 I/O operation are performed by OS
 Manage computer services
 Handle the order and execution of the program
Examples:
 Windows
 Linux
 Unix
 Mac OS
Good operating system
 Support different hardware Architecture
 Better utilization of resources and execution time
 Power utilization

 Compiling Program

 Analyze a program developed in a particular computer language


and then translates it into a form that is suitable for execution on
your particular computer system
 IDE (Integrated Development
Environment)

 Process of editing, compiling, running and debugging program


 Windows based programs can easily manage large software
Example:
 C
 C++
 Java etc.

 C Programming
 Case sensitive
 Line spacing doesn’t matter in C language
 C is a powerful general-purpose programming language
 Used to develop operating system, compiler, databases
First C program
#include<stdio.h>
int main ()
{
Printf (“My name is Shuja\n My father name is Qurban Hussain”);
Return 0;
}

Output:
My name is Shuja
My father name is Qurban Hussain

You might also like