You are on page 1of 12

Unit 1

Overview of C Language

Faculty: Ms. Malarvizhi U


Class: BCA Semester I
Subject: Programming in C
Modular Programming

• A module is a separate software component


• process of subdividing a computer program
into separate sub programs.
• Minimum dependencies between
components
• Modules are short, simple and easy to
understand.
• Reusability
• Eg : COBOL, FORTRAN
Structured Programming • Top down Design Model
• Technique for organizing computer
programs in which Hierarchy of modules
Program1
are used, each having single entry and
exit without unconditional branch to
higher level modules.
Module 1 • 3 types of Control Structures
• Sequence
• Selection
• Iteration
Module 2
• Easy to write
• Easy to debug
• Easy to understand

Module 3
•ExitEg C, Pascal
Program Development
Program Development include the following phases:
 Problem Definition
 Problem Analysis
 Design of Solution
 Design tools
 Computer Solution
 Coding
 Testing and Debugging
 Documentation
 Maintenance
Problem Definition and Analysis
Problem Definition:
 This step defines the problem thoroughly. Here requirements are specified. This
step includes understanding the problem very well.
 The problem solver must understand problem very well to solve problem
efficiently.
 A clear and concise problem statement is provided.
 The problem definition should specify the input and output.
Problem Analysis:
 Analyzing the problem or analysis involves identifying the following:
 Inputs, i.e. the data you have to work with.
 Outputs i.e. the desired results.
 Any additional requirements on the solutions.
Design of solution
 To achieve the best possible solution to a given problem, various
design strategies are suggested and used.
 Some commonly used strategies are:
 Divide and conquer
 Top down approach
 Bottom up approach
 Modular design
 Structured programming
 A good design can be implemented through design tools such as
algorithm and flowcharts.
Design tools - Algorithm
 An Algorithm is a step-by-step procedure to solve a given problem.
 A well defined algorithm has the five basic characteristics; as follows
• Input − An algorithm should have 0 or more well-defined inputs.
• Output − An algorithm should have 1 or more well-defined outputs, and should
match the desired output.
• Finiteness − Algorithms must terminate after a finite number of steps.
 Unambiguous − Algorithm should be clear and unambiguous.
 Feasible: The algorithm must be simple, generic and practical, such that it can be
executed upon will the available resources.
Algorithm -Example
Problem − Design an algorithm to add two numbers and display the result.

Step 1 − START

Step 2 − declare three integers a, b 

Step 3 − define values of a & b

Step 4 − add values of a & b

Step 5 − store output of step 4 to c

Step 6 − print c

Step 7 − STOP


Algorithm - Example
Problem: To convert temperature in Celsius to Fahrenheit
(F = C×(9/5)+32)
Step:1 Start
Step 2: Read C
Step 3: Calculate F= 9 / 5 * C + 32
Step:4 [Print F]
Print ‘Temperature in F’= F
Step 5: Stop
Design tools - Flowchart

 A Flowchart is a pictorial or graphical representation of an algorithm

 Flowchart plays an important role in the programming of a problem and helpful in


understanding the logic of program.

 Once the flow chart is drawn, it becomes easy to write program in any high level
language.
Symbols used in Flowchart
Flowchart
 Flowchart to convert temperature from Celsius to Fahrenheit

You might also like