Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

Programming-1

Computational
Thinking for
Design
KLEF P-1(CTD) BES-1
Course Road Map
CO 1
SemInExam-1
CO 2
End Exam
CO 3
SemInExam-2
CO 4

INTERNAL EXTERNAL
ASSESSMENT ASSESSMENT
60 40
KLEF P-1(CTD) BES-1
Independent Learning:

1. Coursera Course:

Computational Thinking with Beginning C Programming


https://www.coursera.org/programs/coursera-response-
program-for-kl-university-
dkj6o/browse?productId=hPTXdasoEeiY5QqSMz6ei
A&productType=s12n&query=Computational+Thinki
ng+&showMiniModal=true

KLEF P-1(CTD) BES-1


• Course Title : Programming – 1 (CTD)
• Course Code : 20SC1101
• L-T-P-S Structure : 3-0-2-6
• Credits : 6
• Pre-requisite : Problem Solving Ability
Logical Thinking

KLEF P-1(CTD) BES-1


Introduction to Computers
Literally

Modern Computers
More Pervasive in Life
Computers has to do much more than to calculate
KLEF P-1(CTD) BES-1
Receives

Input Stores and Processes


Electronic Device
As per the
instructions
given

Output

KLEF P-1(CTD) BES-1


Simple Flow of Computer
2+3 Addition ie (2 + 3) 5

INPUT PROCESS OUTPUT

Obtained after
Applies any
Data Processing
operation
instructions

KLEF P-1(CTD) BES-1


Input-Process-Output Model
Arithmetic
Logic Unit

Input Unit Control Unit Output Unit

Memory Unit

KLEF P-1(CTD) BES-1


Input Unit
Device Used to input data and Instructions
Output Unit
Device Used to provide information for user in the
required format.
Control Unit
All the parts of Computer are interacted through this CPU
Unit.
Arithmetic Logic Unit
All Arithmetic Operations and Logic Operations takes
place here.
Memory Unit
All Input data instructions that are processed is stored
here
KLEF P-1(CTD) BES-1
Computer Devices

That can be used and touched are hardware


components of a computer

Set of Instructions or programs that make computer


function using these hardware parts are called
software.

KLEF P-1(CTD) BES-1


Introduction to C
General Purpose
High Level
Language

BCPL B 1972

C
KLEF P-1(CTD) BES-1
C Became So Popular

Easy to Learn Complied on Variety of


Computers & also Faster
Execution

Structured Language Extensible

KLEF P-1(CTD) BES-1


Uses of C
Developed for System
Development particularly for
Operating System

Examples where C is Used

Text Application
Editors Programs
KLEF P-1(CTD) BES-1
First Program in C

#include<stdio.h>
main()
{
printf(“HelloWorld”);
}

KLEF P-1(CTD) BES-1


 Pre-processor Directive
 This statement has to be
included in all programs
 Informs complier to
include Files
 stdio headerfile printf
 main() denotes the
function
 Every C program should
have a main function
 Denotes the start of the
program
 Scope of main has started  printf is a library
 Marks the beginning of main function function which prints
 All the statements are enclosed in braces what ever the user
KLEF P-1(CTD) requires BES-1
1972

BCPL and B

Introduction
to C

C Program Reasons why


C Became
Popular

KLEF P-1(CTD) BES-1


Introduction to Structured Programming

Structured Programming

Top-Down Analysis

Modular Programming

Structured Code
KLEF P-1(CTD) BES-1
Structured Programming

Programming Style

QUALITY CLARITY DEVELOPMENT TIME

BLOCK STRUCTURES
KLEF P-1(CTD) BES-1
 Better Way to Program

 Systematic Organization

main() Inefficient Code


{
....
....
....
goto X
....
} SpaghettiCode

KLEF P-1(CTD) BES-1


Structured Programming

Top-Down Modular Structured


Analysis Programming Code

KLEF P-1(CTD) BES-1


Top-Down Analysis

KLEF P-1(CTD) BES-1


Top-Down Analysis
Method Program Analysis Analyse the Solution

main()
{
. . . .
Approach . . . .
}
main() fun1()
{
{ . . . .
. . . .
. . . . }
fun2()
. . . . {
. . . . . . . .
. . . .
} }

KLEF P-1(CTD) BES-1


Idea
Sub Division of Program

Analyise and Appropriate Solution is generated

Advantages

Reduces Problem Solving

Not Limited to Particular type of Program

KLEF P-1(CTD) BES-1


Modular Programming

Program

Solution

Larger Problems

Developing Solution

Complicated

KLEF P-1(CTD) BES-1


Designing Style main()
{
. . . .
Independent Units . . . .
} Entry
Modules function1() point
{
. . . .
Functions control . . . .
}
function2()
Variables Source Code {
. . . .
. . . . return
}

KLEF P-1(CTD) BES-1


Contd. Modular Programming
Solution Which are
Larger Problems difficult to Program

Advantages

Small Modules Saves Reusable


are Manageable Production Time Code

KLEF P-1(CTD) BES-1


Structured Code

Old Unstructured
Languages Code

Well
Organised
Code
KLEF P-1(CTD) BES-1
Advantages
Improves Problem Solving

Organisation of Program

Generalisation of Program Methodology

Clear Structure & Description

Easily Modifiable

KLEF P-1(CTD) BES-1


KLEF P-1(CTD) BES-1
KLEF P-1(CTD) BES-1
THANK
YOU

KLEF P-1(CTD) BES-1

You might also like