Docsity

C programming for problem solving, Exercises of C programming

Partial preview of the text

Download C programming for problem solving and more Exercises C programming in PDF only on Docsity!

21CSS101J – Programming for Problem Solving

Unit I

INSTITUTE OF SCIENCE ANDTECHNOLOGY,

CHENNAI.

Prepared by:

DR.D.SHINY IRENE

ASSITANT PROFESSOR(CTECH)

SRMIST-KTR

INSTITUTE OF SCIENCE AND TECHNOLOGY,

CHENNAI.

INSTITUTE OF SCIENCE ANDTECHNOLOGY,

CHENNAI.

UNIT I (TOPICS

COVERED)

Evolution of Programming & Languages - Problem Solving

through Programming - Creating Algorithms - Writing

Pseudocode - Evolution of C language, its usage history - Input

and output functions: Printf and scanf - Variables and

identifiers – Expressions - Single line and multiline comments

  • Constants, Keywords - Values, Names, Scope, Binding, Storage

Classes - Numeric Data types: integer -

INSTITUTE OF SCIENCE ANDTECHNOLOGY,

CHENNAI.

UNIT I (TOPICS

COVERED)

floating point - Non-Numeric Data types: char and string -

Increment and decrement operator - Comma, Arrow and

Assignment operator - Bitwise and Sizeof operator Arithmetic,

Relational and logical Operators, Condition Operator, Operator

Precedence - Expressions with pre / post increment operator

INSTITUTE OF SCIENCE ANDTECHNOLOGY,

CHENNAI.

Evolution of Programming & Languages Contd…

Period Programming Langugaes 1950’s Creation of high-level languages 1960’s Forth. Simula I. Lisp, Cobol 1970’s Pascal, C language 1980’s ML. Smalltalk, C++ 1990’s Java, Perl, Python languages 2000 Internet Programming 2010 Concurrency and asynchronicity. JavaScript and Go language

INSTITUTE OF SCIENCE ANDTECHNOLOGY,

CHENNAI.

Problem Solving through Programming Contd…

i. Creative Thinking
 Proven method for approaching a challenge or opportunity in

an imaginative way

 Process for innovation that helps explore and reframe the

problems faced, come up with new, innovative responses and solutions and then take action

 It is generative, nonjudgmental and expansive
 Thinking creatively, a lists of new ideas are generated

INSTITUTE OF SCIENCE ANDTECHNOLOGY,

CHENNAI.

Problem Solving through Programming Contd…

ii. Critical Thinking
 Engages a diverse range of intellectual skills and activities that

are concerned with evaluating information, our assumptions and our thinking processes in a disciplined way so that we can think and assess information more comprehensively

 It is Analytical, Judgmental and Selective
 Thinking critically allows a programmer in making choices

INSTITUTE OF SCIENCE ANDTECHNOLOGY,

CHENNAI.

Problem Solving through Programming Contd…

 Program - Set of instructions that instructs the computer to do a

task

 Programming Process
a) Defining the Problem
b) Planning the Solution
c) Coding the Program
d) Testing the Program
e) Documenting the Program

INSTITUTE OF SCIENCE ANDTECHNOLOGY,

CHENNAI.

Problem Solving through Programming Contd…

INSTITUTE OF SCIENCE ANDTECHNOLOGY,

CHENNAI.

Problem Solving through Programming Contd…

b) Refine the algorithm successively to get step by step detailed

algorithm that is very close to a computer language

c) Pseudocode is an artificial and informal language that helps

programmers develop algorithms

 Pseudocode is very similar to everyday English

Algorithm: a step-by-step method for solving a

problem or doing a task.

INSTITUTE OF SCIENCE ANDTECHNOLOGY,

CHENNAI.

Creating Algorithms

 An informal definition of an algorithm is:

i

INSTITUTE OF SCIENCE ANDTECHNOLOGY,

CHENNAI.

Creating Algorithms

 Notations
 Starting point
 Step Numbers – Positions in Algorithm
Incoming Information - Input
 Control Flow – Order of evaluating Instructions
 Statements
 Outgoing Information - Output
 Ending Point

INSTITUTE OF SCIENCE ANDTECHNOLOGY,

CHENNAI.

Creating Algorithms Contd…

 Properties of an algorithm
 Finite : The algorithm must eventually terminate
 Complete : Always give a solution when one exists
 Correct (sound) : Always give a correct solution
 Rules of Writing an Algorithm
 Be consistent
 Have well Defined input and output
 Do not use any syntax of any specific programming language