Professional Documents
Culture Documents
Anirban Mitra
Assistant Professor
Department of Mechanical Engineering
Jadavpur University
Name of Course: Computer Programming
• Year: 1st, Semester: 2nd
• Session: 2020-21
• Syllabus:
▪ Introduction: History of Computing, Evolution of Programming Languages, Compilers, Interpreter
Algorithms and Flowcharts, Structure of a C Program. [33 h]
▪ Expressions : Basic Data Types, Variables, Type Qualifiers, Variable Scopes, Constants, Assignment
Statements, Operators, Operator Precedence, Expression Evaluation, Type Conversion in Expressions,
Type Casting; Console I/O: Reading and Writing different data types [23 h]
▪ Control Statements: Selection Statements (if, switch-case), Loop Statements (for, while, do-while), Jump
Statements (return, goto, break, exit, continue) [23 h]
▪ Arrays and Strings: Single Dimension Arrays, Double Dimension Arrays, Strings [23 h]
▪ Functions: General Form, Function Prototypes, Introduction to Pointer variables, Parameter Passing
Mechanisms, Command Line Arguments [23 h]
▪ File I/O: Introduction to File, File reading and writing [13 h]
▪ Structures, Unions: Structures, Arrays of Structures, Unions [13 h]
Jadavpur 2
University
Introduction
▪ Computer is a wonderful invention, whose importance in material and intellectual progress of
mankind is well recognised in developed as well as developing countries
▪ Computers are being used in almost every field of modern society
▪ A computer can neither think nor take decisions on its own
− Can not decide a method to find solutions
▪ Computer only understands what to do when it is told the problem and how to obtain the solution Communication
to the problem in precise and unambiguous form with Computer –
Programming
▪ Most difficult and important task in programming – not preparation of instructions for the
Languages
computer to solve a given problem
− Systematic and careful analysis of the entire problem and deciding upon an effective
method of solution
Jadavpur 3
University
Introduction
▪ Steps to solve any physical problem utilizing computers:
− Convert the physical problem into a mathematical model (formulate the mathematical equations)
− Select a suitable method to solve the mathematical equations and write down the steps necessary
for obtaining the solution in the form of an Algorithm
− Graphically represent the procedural steps to be executed for solving the given problem (Draw
detailed Flow chart)
− Convert the flow chart into a source program
− Compile and execute the program
Jadavpur 4
University
Introduction
Logic of
problem solution Source Programme Object Programme
Compilation Execution
Compiler/Interpreter
System Software
Physical Mathematical
Governing
Problem Model
Equations
Jadavpur 5
University
Algorithm
Jadavpur 6
University
Algorithm
▪ A complete and unambiguous set of computational steps to be followed in a particular sequence
to obtain solution to a given problem
Jadavpur 7
University
Algorithm: Important Features
▪ Important features of an algorithm:
− Finiteness: terminate after a finite no. of steps
− Definiteness: steps must be clearly defined (unambiguous action)
− Input: quantities to be read as input
− Output: quantities to be displayed
− Effectiveness: all operations must be executable (avoid division by 0, -ve no. under root etc.)
Jadavpur 8
University
Flowchart
Jadavpur 9
University
Flowchart
▪ Visual/Graphical representation of the sequential steps of the algorithm required to produce the
solution to a problem
Jadavpur 10
University
Shape Name Description
An arrow coming from one symbol and ending at another
Flow Line symbol represents that control passes to the symbol the arrow
points to.
Alternative to parallelogram
Input: Symbol specifying quantities which are to be read before processing can
proceed
Jadavpur 12
University
Example: Algorithm and Flowchart
Write down an algorithm to calculate and print the value of K, where,
100
𝐾 = 𝐽2
𝐽=1
Jadavpur 13
University
Example: Algorithm and Flowchart
Write down an algorithm to calculate and print the value of K, where,
100
𝐾 = 𝐽2
𝐽=1
Jadavpur 14
University
THANK YOU