The first
ASSIGNMENT
PROGRAMMING
FUNDAMENTAL
SUBMITTED BY:
SAGHEER HUSSAIN
SUBMITTED TO:
MISS TAYYABA KHALID
DEPARTMENT OF BS (SOFTWARE ENGINEERING)
GRAND ASIAN UNIVERSITY OF SIALKOT
SAGHEER Page 1
PROBLEM SOLVING
Problem solving means the ability to find a solution of a problem and to think
about it and express the solution clearly.
There are two phases;
1. Problem solving
2. Implementation phase
Problem solving
There are two types of problem solving first is define the problem and
second is to design the solution of this problem.
Implementation phase
There are several steps in the implementation phase like write code, compile,
link, test and debug.
ALGORITHEMS
Algorithm is a method of solving a problem it contains two steps they are
language independent steps which are given below.
Pseudo Code
Flowcharts
PSEUDO CODES
Pseudo code is a method of describing or solving a problem simply in an
English sentence or statement. There are no real rules or symbols used in this
type of method.
FLOWCHARTS
The diagrammatic, symbolic or graphic solution of the given problem is
represented by flowcharts. The steps of representing a problem by flowchart
are given below.
SAGHEER Page 2
NAMES SYMBOLS
Start/Stop
Input /Output
Processing
Decision
Arrange
STRUCTURED PROGRAMMING
It is necessary to understand the structure of program to develop any
program. The purposes of structuring a program are it becomes clear for the
user, user friendly, to avoid time consuming. The Sequence in the any
program is necessary. Selection and Iteration is also very important in the
program.
After structuring a program it becomes understand able for the user as well
as computer.
MODULAR PROGRAMMING
Modular programming is a technique that divides a program into several
steps like functions, classes, or procedures.
Each module controls the specific part of the given program and in this way
the program becomes easier to compile and debug.
When the specific module controls the specific part of the program then it
becomes easier to maintain, understand and debug.
Principles
The principles of modular programming Encapsulation in which only external
working is indicated .The Abstraction involves in simplifying the complex
SAGHEER Page 3
process. In the High cohesion each module is responsible for its specific task.
And Reusability describes that modules are designed in such a way that they
can be reused in different programs.
Translator in programming
Translator is used in the programming as a tool that changes the high level
language into machine language or computer understandable language.
In the types of translator Compiler changes the entire language at once and
shows error after completing the program. Its processing is very fast as
compared to interpreter.
Interpreter changes the language of a program line by line and shows error
when a line is completed. Its execution speed is slow.
An Assembler translates the assembly language into machine or binary
language.
SOURCE CODE OBJECT CODE
It is generated by It is generated after the
programmer. compilation.
Source code is high level Object code is low level
language. language.
Source code is human Object code is machine
understandable. understandable.
It can be easily modified. It cannot be easily modified.
MACHINE CODE
SAGHEER Page 4
Machine code is the low language code which is directly executed by the
central processing unit.
It is not understandable by the human but machine can understand it very
easily because it is in binary numbers (1, 0).
BASIC FLOW OF THE PROGRAM
SOURCE CODE
COMPILER
OBJECT CODE
LINK
LIBRARIES
EXECUTION
MACHINE CODE
OUT PUT
STRUCTURE OF C –LANGUAGE IN PROGRAM
Pre Processor Directives
These are the lines that start from the keyword #.
There are two libraries which are mostly used in the programs one for
print and another for scan.
Global and Local Declaration
SAGHEER Page 5
If the variable is declared inside the main () then it will be Local
Declaration otherwise Global Declaration.
Main Function
Every program must contain the main function. In this function all the
statement is written.
The return value of main () indicates the success as well as the failure
of that program.
Statement
Everything written in the main function is called the statement.
Statement includes the variables, symbols and functional calls etc.
Comments
Comments are used in the program to make it easy to understand for
the programmer and read able for him.
There are two types of comments in the program.
1. Single line comment Denoted by /* and */
2. Double line comment Denoted by //
OUTPUT STATEMENT IN C-LANGUAGE
In C, the most common output statement is print f () function.
There are two categories of output statement. The format string is written in
the inverted commas and the argument is written after the format string.
Example:
Print f (“format string”, argument);
OR
Print f (‘’%d/n’’, sum);
SAGHEER Page 6