SlideShare a Scribd company logo
1 of 76
CSEG1001 Computer Programming
CSEG 1001
Computer Programming
Instructor
Dhiviya Rose J . Asst. Prof. Senior Scale
School of Computer Science and Engineering | UPES
CSEG1001 Computer Programming
Road Map
• Generations of Computers and Languages
• Organization of Computers-Online Lecture
• Number Systems Conversion
• Logical Analysis and Thinking
Introduction to
Computers
• Structure of C Program & Compilation and Linking Process
• Variables and Datatypes
• Managing Input and Output statements
• Decision and Looping Statements
C Programming
Basics
• Creation and Usages
• 1D and 2 D arrys
• String Functions
• Matrix operations
Arrays and
Strings
• Declaration and Definitions of Functions
• Passing Arguments
• Recursion
• Pointers & Pointer Arithmetic
Functions and
Pointers
• Need of Structure and Unions
• Declaration and Definition
• Storage classes
• Preprocessor Directives
Structures and
Unions
CSEG1001 Computer Programming
LECTURE #1
EVOLUTION & GENERATION OF COMPUTERS &
LANGUAGES
Instructor
Dhiviya Rose J . Asst. Prof. Senior Scale
School of Computer Science and Engineering | UPES
CSEG1001 Computer Programming
History
• Abacus
• Sliding Beads on a rack
• Counting purpose
• Operators on addition and subtraction
• 300 B.C.
• Napier Bones
• Logarithmic value carved on ivory sticks
• Scotsman ->John Napier
• 1617
CSEG1001 Computer Programming
Abacus – Addition and Subtraction
CSEG1001 Computer Programming
Napier’s Bones - Multiplication
CSEG1001 Computer Programming
Steps……..Inventions
• Pascaline Machine
• Functional Automatic Calculator
• French Mathematician
• Blaise Pascal
• 1642
• gear-driven calculating machine
• Eight movable dials
CSEG1001 Computer Programming
Gear Engine
CSEG1001 Computer Programming
CSEG1001 Computer Programming
Steps……..Inventions
• Leibniz's Stepped Reckoner
• 1694
• German Mathemacian
• addition, subtraction, multiplication, and division
• Jacquard Powerloom
• 1801
• weave automatically
• read from punched wooden cards
CSEG1001 Computer Programming
Leibniz's Stepped Reckoned
CSEG1001 Computer Programming
Steps……..Inventions
• Jacquard Powerloom
• 1801
• weave automatically
• Programs punched in cards
• read from punched wooden cards
CSEG1001 Computer Programming
Jacquards Loom
CSEG1001 Computer Programming
Practical Jacquards Loom
CSEG1001 Computer Programming
Sample Punch card
CSEG1001 Computer Programming
• Differential Engine
• Charles Babbage – Father of Computers
• English Mathematician
• 1822
• First Computer
• Basic calc+ Log + Differential equation
• Steam Driven machine
• Single Stored program in Memory
• Memory + Central Processing Unit
• Punch Cards as memory
Steps……..Inventions
CSEG1001 Computer Programming
Steps……..Inventions
• Analytical Engine
• Charles Babbage
• 1833
• Fully functional
• differential engine
• Contains
• Input device as cards
• Control unit
• Output device
CSEG1001 Computer Programming
CSEG1001 Computer Programming
Steps…Inventions
• Hollerith Tabulator
• Herman Hollerith
• 1889
• U.S Census Bureau
• Official Purpose
• Punch cards
• store data
• Used Electricity
• Later IBM
• Mainframe+OS
• OS/2 -> OS with
windows
CSEG1001 Computer Programming
Memory Tapes
CSEG1001 Computer Programming
MainFrame Computers – 1955 - US
CSEG1001 Computer Programming
Steps……..Inventions
• Mark 1
• 1944
• IBM + Harvard Aiken
• Replaces the mechanical component
• Relays
• Electro magnetic component
• ENIAC
• 1946
• John Eckert and John Mauchly
• Electronic Numerical Integrator And Calculator
• Electronic Vaccum Tubes
CSEG1001 Computer Programming
Steps……..Inventions
• EDVAC
• Electronic Discrete Variable Automatic Computer
• John Eckert and John Mauchly
• Capability to stop and resume
• EDSAC
• Electronic Delay Storage Automatic Calculator
• 1949
• Maurice Wilkes
• Mercury delay lines – memory
• Vacuum tubes --- logic
CSEG1001 Computer Programming
Steps……..Inventions
• UNIVAC
• Universal Automatic Compute
• 1951
• Beginning of computer era
• John Eckert and John Mauchly
• 1970
• Integrated Circuits
• Replaces vaccum tubes
• 1980
• Very Large Scale Integration (VLSI)
CSEG1001 Computer Programming
Mini Comp. ---Apple1 -- $600 ---1976
CSEG1001 Computer Programming
IBM PC ---- 1990
CSEG1001 Computer Programming
Apple II
CSEG1001 Computer Programming
GENERATION OF
COMPUTERS
CSEG1001 Computer Programming
CSEG1001 Computer Programming
First Generation
• 1940 – 1956
• Vaccum Tubes
• Machine Language
• Specification
• Vacuum tubes -> circuitry
• Magnetic drums -> memory
• Input ->punched cards and paper tape
• Output ->printouts
• Examples
• UNIVAC -U.S. Census Bureau in 1951
• ENIAC computers
• Disadvantage
• Expensive
• Huge conception of electricity
• Big & Clumsy
• Air conditioning Necessary
• Non portable
CSEG1001 Computer Programming
CSEG1001 Computer Programming
Second Generation
• 1956 - 1963
• Transistor
• used to relay and switch electronic signals
• Assembly language
• Specification
• punched cards for input
• printouts for output
• Transistor for circuits
• magnetic core technology for memory
• Computers smaller, faster, cheaper, portable and
more energy-efficient and need air conditioning.
CSEG1001 Computer Programming
CSEG1001 Computer Programming
Third Generations
• 1964 – 1970
• Integrated Circuits
• Transistors were miniaturized and placed on silicon chips called
semiconductors
• High Level Language
• Specifications
• Keyboard as input
• Monitor as output
• Operating System
• Central program that controls the devices
• Advantages
• Speed
• Efficiency
• Portable
• Cheap
• Less power
CSEG1001 Computer Programming
CSEG1001 Computer Programming
Fourth Generation
• 1970 – Present
• Data Communication
• Microprocessors
• thousands of integrated circuits were built onto a single silicon chip
• Properties
• Instruction set
• Bandwidth
• Clock Speed
• Example
• Intel 4004 chip – minuscule chip(cpu+ memory+ i/p+ o/p unit)
• 1984 Apple introduced the Macintosh
• Specification
• Microprocessor
• Mouse and other handheld devices
• CPU and ALU
• RAID – Redundant array of Independent Disk for memory
CSEG1001 Computer Programming
CSEG1001 Computer Programming
Fifth Generation
• Present and Beyond
• Artificial Intelligence
• Game Playing
• Expert System
• Robotics
• Mega chips
• Parallel processing
• Voice Recognition
• Example
• No fully AI computers
• 1997, an IBM super-computer called Deep Blue defeated world
chess champion Gary Kasparov in a chess
CSEG1001 Computer Programming
CSEG1001 Computer Programming
Classification of Computers
Types of Computers
On the basis of
Purpose
Special
Purpose
General
Purpose
On the basis of Technology
Analog
Digital
Hybrid
On the basis of Size &
Capacity
Super
Main Frame
Mini
Micro
CSEG1001 Computer Programming
Super Computers
CSEG1001 Computer Programming
Main Frame Computer
CSEG1001 Computer Programming
Mini Computers
CSEG1001 Computer Programming
Micro Computers
CSEG1001 Computer Programming
Mini Computers
CSEG1001 Computer Programming
Generation of Programming Languages
CSEG1001 Computer Programming
CSEG1001 Computer Programming
LECTURE #3
ALGORITHM, FLOWCHARTAND PSEUDOCODE
Instructor
Dhiviya Rose J . Asst. Prof. Senior Scale
School of Computer Science and Engineering | UPES
CSEG1001 Computer Programming
Software Development Method
Execute & Test
Finally, the program is tested to verify that it behaves as intended.
Coding -------Write Program with some Programming Language
C C++ Java ….
Modify the solution if necessary
Check it
Analysis & Design Plan It
algorithm flowchart pseudocode
PreProgrammingSteps
Introduction to Algorithms
• The algorithm is the abstract idea of solving a problem.
• The algorithm is written in user language
Algorithms vs. programs
• When an algorithm is coded using any programming
language (e.g. C++), then it is called a program.
• The program is a set of instructions that can run by the
computer.
• The algorithm would consist of at least the
following tasks:
1- Input (Read the data)
2- Processing (Perform the computation)
3- Output (Display the results)
Example 1
• Write a algorithm to find an area of a circle where area = pi
* radius * radius
Data Processing Output
radius area = 3.14 x radius x radius area
Flowchart
• It is another way to display the algorithm.
• Diagram representation –
• special geometric symbols connected by lines and contain
the instructions.
Flowchart Symbols
Symbol Function
Show the direction of data flow or logical
solution.
Indicate the beginning and ending of a set of
actions or instructions (logical flow) of a module
or program.
Indicate a process, such as calculations,
opening and closing files.
Indicate input to the program and output from the
program.
Use for making decision. Either True or False based
on certain condition.
Use for doing a repetition or looping of certain steps.
Connection of flowchart on the same page.
Connection of flowchart from page to page.
Pseudocode
• Writing the Pseudocode
• Pseudocode means an imitation computer code.
• It is used in place of symbols or a flowchart to describe
the logic of a program. Thus, it is a set of instructions
(descriptive form) to describe the logic of a program.
• Pseudocode is close to the actual programming
language.
• Using the Pseudocode, the programmer can start to
write the actual code.
Structuring a Program
• Develop efficient computer solution to problems:
1. Use Modules
2. Use four logic structures
a. Sequential structure
• Executes instructions one after another in a sequence.
b. Decision structure
• Branches to execute one of two possible sets of instructions.
c. Loop structure
• Executes set of instruction many times.
d. Case structure
• Executes one set of instructions out of several sets.
3. Eliminate rewriting of identical process by using modules.
4. Use techniques to improve readability including four logic
structure, proper naming of variables, internal documentation
and proper indentation.
Sequential Logic Structure
The Decision Logic Structure
• Implements using the IF/THEN/ELSE instruction.
• Tells the computer that IF a condition is true, THEN
execute a set of instructions, or ELSE execute another set
of instructions
• ELSE part is optional, as there is not always a set of
instructions if the conditions are false.
• Algorithm:
IF <condition(s)> THEN
<TRUE instruction(s)>
ELSE
<FALSE instruction(s)
Decision Logic Structure
Example:1
CSEG1001 Computer Programming
The Loop Logic Structure
• Repeat structure
• To solve the problem that doing the same task over and
over for different sets of data
• Types of loop:
• WHILE loop
• Do..WHILE loop
• Automatic-Counter Loop
Loop Logic Structure
Examples
CSEG1001 Computer Programming
The Case Logic Structure
• Made up of several or many sets of instructions, only one
of which will be selected by the user and executed by the
computer
• Algorithm:
CASE OF VARIABLE
= constant1:
actions for VARIABLE = constant1
= constants2:
actions for VARIABLE = constant2
…
OTHERWISE:
Actions for VARIABLE = anything else
END-OF-CASE
Case Logic Structure
Actual Implementation
CSEG1001 Computer Programming
Example: Biggest of 3 numbers
CSEG1001 Computer Programming
Example for case structure
CSEG1001 Computer Programming
Example for Loop
CSEG1001 Computer Programming
CSEG1001 Computer Programming

More Related Content

What's hot

Chapter 1 - An Overview of Computers and Programming Languages
Chapter 1 - An Overview of Computers and Programming LanguagesChapter 1 - An Overview of Computers and Programming Languages
Chapter 1 - An Overview of Computers and Programming LanguagesAdan Hubahib
 
Logic Formulation 1
Logic Formulation 1Logic Formulation 1
Logic Formulation 1deathful
 
CIS110 Computer Programming Design Chapter (1)
CIS110 Computer Programming Design Chapter  (1)CIS110 Computer Programming Design Chapter  (1)
CIS110 Computer Programming Design Chapter (1)Dr. Ahmed Al Zaidy
 
Programming Fundamentals and basic knowledge
Programming Fundamentals and basic knowledge Programming Fundamentals and basic knowledge
Programming Fundamentals and basic knowledge imtiazalijoono
 
CIS110 Computer Programming Design Chapter (5)
CIS110 Computer Programming Design Chapter  (5)CIS110 Computer Programming Design Chapter  (5)
CIS110 Computer Programming Design Chapter (5)Dr. Ahmed Al Zaidy
 
Logic Formulation 2
Logic Formulation 2Logic Formulation 2
Logic Formulation 2deathful
 
2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life Cycle2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life CycleFrankie Jones
 
Principles Of Programing Languages
Principles Of Programing LanguagesPrinciples Of Programing Languages
Principles Of Programing LanguagesMatthew McCullough
 
Problem solving (C++ Programming)
Problem solving (C++ Programming)Problem solving (C++ Programming)
Problem solving (C++ Programming)Umair Younas
 
Cs1123 2 comp_prog
Cs1123 2 comp_progCs1123 2 comp_prog
Cs1123 2 comp_progTAlha MAlik
 
Introduction to programming principles languages
Introduction to programming principles languagesIntroduction to programming principles languages
Introduction to programming principles languagesFrankie Jones
 
Algorithmic problem sloving
Algorithmic problem slovingAlgorithmic problem sloving
Algorithmic problem slovingMani Kandan
 

What's hot (20)

Chapter 1 - An Overview of Computers and Programming Languages
Chapter 1 - An Overview of Computers and Programming LanguagesChapter 1 - An Overview of Computers and Programming Languages
Chapter 1 - An Overview of Computers and Programming Languages
 
Algorithm Pseudo
Algorithm PseudoAlgorithm Pseudo
Algorithm Pseudo
 
Logic Formulation 1
Logic Formulation 1Logic Formulation 1
Logic Formulation 1
 
CIS110 Computer Programming Design Chapter (1)
CIS110 Computer Programming Design Chapter  (1)CIS110 Computer Programming Design Chapter  (1)
CIS110 Computer Programming Design Chapter (1)
 
Programming Fundamentals and basic knowledge
Programming Fundamentals and basic knowledge Programming Fundamentals and basic knowledge
Programming Fundamentals and basic knowledge
 
CIS110 Computer Programming Design Chapter (5)
CIS110 Computer Programming Design Chapter  (5)CIS110 Computer Programming Design Chapter  (5)
CIS110 Computer Programming Design Chapter (5)
 
Logic Formulation 2
Logic Formulation 2Logic Formulation 2
Logic Formulation 2
 
System Programming Overview
System Programming OverviewSystem Programming Overview
System Programming Overview
 
2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life Cycle2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life Cycle
 
Principles Of Programing Languages
Principles Of Programing LanguagesPrinciples Of Programing Languages
Principles Of Programing Languages
 
Graphical programming
Graphical programmingGraphical programming
Graphical programming
 
Mcs lec2
Mcs lec2Mcs lec2
Mcs lec2
 
Problem solving (C++ Programming)
Problem solving (C++ Programming)Problem solving (C++ Programming)
Problem solving (C++ Programming)
 
Cs1123 2 comp_prog
Cs1123 2 comp_progCs1123 2 comp_prog
Cs1123 2 comp_prog
 
Algorithms - Introduction to computer programming
Algorithms - Introduction to computer programmingAlgorithms - Introduction to computer programming
Algorithms - Introduction to computer programming
 
Chapter 02 - Problem Solving
Chapter 02 - Problem SolvingChapter 02 - Problem Solving
Chapter 02 - Problem Solving
 
Introduction to programming principles languages
Introduction to programming principles languagesIntroduction to programming principles languages
Introduction to programming principles languages
 
Algorithmic problem sloving
Algorithmic problem slovingAlgorithmic problem sloving
Algorithmic problem sloving
 
L1
L1L1
L1
 
COMPUTER PROGRAMMING
COMPUTER PROGRAMMINGCOMPUTER PROGRAMMING
COMPUTER PROGRAMMING
 

Similar to CSEG1001 Computer Programming Basics

Programming for Problem Solving Unit 1
Programming for Problem Solving Unit 1Programming for Problem Solving Unit 1
Programming for Problem Solving Unit 1Dhiviya Rose
 
computer organisation architecture.pptx
computer organisation architecture.pptxcomputer organisation architecture.pptx
computer organisation architecture.pptxYaqubMd
 
Presentation on Computer Basics and architecture.pdf
Presentation on Computer Basics and architecture.pdfPresentation on Computer Basics and architecture.pdf
Presentation on Computer Basics and architecture.pdfnavikvel
 
Computer Fundamentals & Intro to C Programming module i
Computer Fundamentals & Intro to C Programming module iComputer Fundamentals & Intro to C Programming module i
Computer Fundamentals & Intro to C Programming module iAjit Nayak
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programmingSangheethaa Sukumaran
 
Functional verification techniques EW16 session
Functional verification techniques  EW16 sessionFunctional verification techniques  EW16 session
Functional verification techniques EW16 sessionSameh El-Ashry
 
Top schools in gudgao
Top schools in gudgaoTop schools in gudgao
Top schools in gudgaoEdhole.com
 
isa architecture
isa architectureisa architecture
isa architectureAJAL A J
 
Top schools in gudgao
Top schools in gudgaoTop schools in gudgao
Top schools in gudgaoEdhole.com
 
OpenCL & the Future of Desktop High Performance Computing in CAD
OpenCL & the Future of Desktop High Performance Computing in CADOpenCL & the Future of Desktop High Performance Computing in CAD
OpenCL & the Future of Desktop High Performance Computing in CADDesign World
 
Top schools in noida
Top schools in noidaTop schools in noida
Top schools in noidaEdhole.com
 
Introduction to embedded computing and arm processors
Introduction to embedded computing and arm processorsIntroduction to embedded computing and arm processors
Introduction to embedded computing and arm processorsSiva Kumar
 

Similar to CSEG1001 Computer Programming Basics (20)

Programming for Problem Solving Unit 1
Programming for Problem Solving Unit 1Programming for Problem Solving Unit 1
Programming for Problem Solving Unit 1
 
aca mod1.pptx
aca mod1.pptxaca mod1.pptx
aca mod1.pptx
 
computer organisation architecture.pptx
computer organisation architecture.pptxcomputer organisation architecture.pptx
computer organisation architecture.pptx
 
Presentation on Computer Basics and architecture.pdf
Presentation on Computer Basics and architecture.pdfPresentation on Computer Basics and architecture.pdf
Presentation on Computer Basics and architecture.pdf
 
Computer Fundamentals & Intro to C Programming module i
Computer Fundamentals & Intro to C Programming module iComputer Fundamentals & Intro to C Programming module i
Computer Fundamentals & Intro to C Programming module i
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programming
 
Functional verification techniques EW16 session
Functional verification techniques  EW16 sessionFunctional verification techniques  EW16 session
Functional verification techniques EW16 session
 
Top schools in gudgao
Top schools in gudgaoTop schools in gudgao
Top schools in gudgao
 
isa architecture
isa architectureisa architecture
isa architecture
 
Top schools in gudgao
Top schools in gudgaoTop schools in gudgao
Top schools in gudgao
 
SPC Unit 1
SPC Unit 1SPC Unit 1
SPC Unit 1
 
OpenCL & the Future of Desktop High Performance Computing in CAD
OpenCL & the Future of Desktop High Performance Computing in CADOpenCL & the Future of Desktop High Performance Computing in CAD
OpenCL & the Future of Desktop High Performance Computing in CAD
 
Chap003
Chap003Chap003
Chap003
 
Top schools in noida
Top schools in noidaTop schools in noida
Top schools in noida
 
Introduction to embedded computing and arm processors
Introduction to embedded computing and arm processorsIntroduction to embedded computing and arm processors
Introduction to embedded computing and arm processors
 
Digi sudoku
Digi sudokuDigi sudoku
Digi sudoku
 
CSC204PPTNOTES
CSC204PPTNOTESCSC204PPTNOTES
CSC204PPTNOTES
 
Programming skills
Programming skillsProgramming skills
Programming skills
 
CAD STANDARDS
CAD STANDARDSCAD STANDARDS
CAD STANDARDS
 
Unit 1b
Unit 1bUnit 1b
Unit 1b
 

More from Dhiviya Rose

Programming for Problem Solving Unit 2
Programming for Problem Solving Unit 2Programming for Problem Solving Unit 2
Programming for Problem Solving Unit 2Dhiviya Rose
 
Module 3 microsoft powerpoint
Module 3 microsoft powerpointModule 3 microsoft powerpoint
Module 3 microsoft powerpointDhiviya Rose
 
Module 3 business computing.pdf
Module 3 business computing.pdfModule 3 business computing.pdf
Module 3 business computing.pdfDhiviya Rose
 
Module 2 Digital Devices and its Applications
Module 2 Digital Devices and its ApplicationsModule 2 Digital Devices and its Applications
Module 2 Digital Devices and its ApplicationsDhiviya Rose
 
Unit 1 Business Computing
Unit 1 Business ComputingUnit 1 Business Computing
Unit 1 Business ComputingDhiviya Rose
 
Module 1 - Digital Devices and its Application
Module 1 - Digital Devices and its ApplicationModule 1 - Digital Devices and its Application
Module 1 - Digital Devices and its ApplicationDhiviya Rose
 
CSEG1001Unit 3 Arrays and Strings
CSEG1001Unit 3 Arrays and StringsCSEG1001Unit 3 Arrays and Strings
CSEG1001Unit 3 Arrays and StringsDhiviya Rose
 
CSEG1001 Unit 4 Functions and Pointers
CSEG1001 Unit 4 Functions and PointersCSEG1001 Unit 4 Functions and Pointers
CSEG1001 Unit 4 Functions and PointersDhiviya Rose
 
CSEG1001 Unit 5 Structure and Unions
CSEG1001 Unit 5 Structure and UnionsCSEG1001 Unit 5 Structure and Unions
CSEG1001 Unit 5 Structure and UnionsDhiviya Rose
 
Lecture 3 internet and web
Lecture 3 internet and webLecture 3 internet and web
Lecture 3 internet and webDhiviya Rose
 
Multidimentional array
Multidimentional arrayMultidimentional array
Multidimentional arrayDhiviya Rose
 
Searching in Arrays
Searching in ArraysSearching in Arrays
Searching in ArraysDhiviya Rose
 

More from Dhiviya Rose (14)

Programming for Problem Solving Unit 2
Programming for Problem Solving Unit 2Programming for Problem Solving Unit 2
Programming for Problem Solving Unit 2
 
Module 3 microsoft powerpoint
Module 3 microsoft powerpointModule 3 microsoft powerpoint
Module 3 microsoft powerpoint
 
Module 3 business computing.pdf
Module 3 business computing.pdfModule 3 business computing.pdf
Module 3 business computing.pdf
 
Module 2 Digital Devices and its Applications
Module 2 Digital Devices and its ApplicationsModule 2 Digital Devices and its Applications
Module 2 Digital Devices and its Applications
 
Software
SoftwareSoftware
Software
 
Unit 1 Business Computing
Unit 1 Business ComputingUnit 1 Business Computing
Unit 1 Business Computing
 
Module 1 - Digital Devices and its Application
Module 1 - Digital Devices and its ApplicationModule 1 - Digital Devices and its Application
Module 1 - Digital Devices and its Application
 
CSEG1001Unit 3 Arrays and Strings
CSEG1001Unit 3 Arrays and StringsCSEG1001Unit 3 Arrays and Strings
CSEG1001Unit 3 Arrays and Strings
 
CSEG1001 Unit 4 Functions and Pointers
CSEG1001 Unit 4 Functions and PointersCSEG1001 Unit 4 Functions and Pointers
CSEG1001 Unit 4 Functions and Pointers
 
CSEG1001 Unit 5 Structure and Unions
CSEG1001 Unit 5 Structure and UnionsCSEG1001 Unit 5 Structure and Unions
CSEG1001 Unit 5 Structure and Unions
 
Lecture 3 internet and web
Lecture 3 internet and webLecture 3 internet and web
Lecture 3 internet and web
 
Strings
StringsStrings
Strings
 
Multidimentional array
Multidimentional arrayMultidimentional array
Multidimentional array
 
Searching in Arrays
Searching in ArraysSearching in Arrays
Searching in Arrays
 

Recently uploaded

Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 

Recently uploaded (20)

Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 

CSEG1001 Computer Programming Basics

  • 2. CSEG 1001 Computer Programming Instructor Dhiviya Rose J . Asst. Prof. Senior Scale School of Computer Science and Engineering | UPES CSEG1001 Computer Programming
  • 3. Road Map • Generations of Computers and Languages • Organization of Computers-Online Lecture • Number Systems Conversion • Logical Analysis and Thinking Introduction to Computers • Structure of C Program & Compilation and Linking Process • Variables and Datatypes • Managing Input and Output statements • Decision and Looping Statements C Programming Basics • Creation and Usages • 1D and 2 D arrys • String Functions • Matrix operations Arrays and Strings • Declaration and Definitions of Functions • Passing Arguments • Recursion • Pointers & Pointer Arithmetic Functions and Pointers • Need of Structure and Unions • Declaration and Definition • Storage classes • Preprocessor Directives Structures and Unions CSEG1001 Computer Programming
  • 4. LECTURE #1 EVOLUTION & GENERATION OF COMPUTERS & LANGUAGES Instructor Dhiviya Rose J . Asst. Prof. Senior Scale School of Computer Science and Engineering | UPES CSEG1001 Computer Programming
  • 5. History • Abacus • Sliding Beads on a rack • Counting purpose • Operators on addition and subtraction • 300 B.C. • Napier Bones • Logarithmic value carved on ivory sticks • Scotsman ->John Napier • 1617 CSEG1001 Computer Programming
  • 6. Abacus – Addition and Subtraction CSEG1001 Computer Programming
  • 7. Napier’s Bones - Multiplication CSEG1001 Computer Programming
  • 8. Steps……..Inventions • Pascaline Machine • Functional Automatic Calculator • French Mathematician • Blaise Pascal • 1642 • gear-driven calculating machine • Eight movable dials CSEG1001 Computer Programming
  • 11. Steps……..Inventions • Leibniz's Stepped Reckoner • 1694 • German Mathemacian • addition, subtraction, multiplication, and division • Jacquard Powerloom • 1801 • weave automatically • read from punched wooden cards CSEG1001 Computer Programming
  • 12. Leibniz's Stepped Reckoned CSEG1001 Computer Programming
  • 13. Steps……..Inventions • Jacquard Powerloom • 1801 • weave automatically • Programs punched in cards • read from punched wooden cards CSEG1001 Computer Programming
  • 15. Practical Jacquards Loom CSEG1001 Computer Programming
  • 16. Sample Punch card CSEG1001 Computer Programming
  • 17. • Differential Engine • Charles Babbage – Father of Computers • English Mathematician • 1822 • First Computer • Basic calc+ Log + Differential equation • Steam Driven machine • Single Stored program in Memory • Memory + Central Processing Unit • Punch Cards as memory Steps……..Inventions CSEG1001 Computer Programming
  • 18. Steps……..Inventions • Analytical Engine • Charles Babbage • 1833 • Fully functional • differential engine • Contains • Input device as cards • Control unit • Output device CSEG1001 Computer Programming
  • 20. Steps…Inventions • Hollerith Tabulator • Herman Hollerith • 1889 • U.S Census Bureau • Official Purpose • Punch cards • store data • Used Electricity • Later IBM • Mainframe+OS • OS/2 -> OS with windows CSEG1001 Computer Programming
  • 22. MainFrame Computers – 1955 - US CSEG1001 Computer Programming
  • 23. Steps……..Inventions • Mark 1 • 1944 • IBM + Harvard Aiken • Replaces the mechanical component • Relays • Electro magnetic component • ENIAC • 1946 • John Eckert and John Mauchly • Electronic Numerical Integrator And Calculator • Electronic Vaccum Tubes CSEG1001 Computer Programming
  • 24. Steps……..Inventions • EDVAC • Electronic Discrete Variable Automatic Computer • John Eckert and John Mauchly • Capability to stop and resume • EDSAC • Electronic Delay Storage Automatic Calculator • 1949 • Maurice Wilkes • Mercury delay lines – memory • Vacuum tubes --- logic CSEG1001 Computer Programming
  • 25. Steps……..Inventions • UNIVAC • Universal Automatic Compute • 1951 • Beginning of computer era • John Eckert and John Mauchly • 1970 • Integrated Circuits • Replaces vaccum tubes • 1980 • Very Large Scale Integration (VLSI) CSEG1001 Computer Programming
  • 26. Mini Comp. ---Apple1 -- $600 ---1976 CSEG1001 Computer Programming
  • 27. IBM PC ---- 1990 CSEG1001 Computer Programming
  • 31. First Generation • 1940 – 1956 • Vaccum Tubes • Machine Language • Specification • Vacuum tubes -> circuitry • Magnetic drums -> memory • Input ->punched cards and paper tape • Output ->printouts • Examples • UNIVAC -U.S. Census Bureau in 1951 • ENIAC computers • Disadvantage • Expensive • Huge conception of electricity • Big & Clumsy • Air conditioning Necessary • Non portable CSEG1001 Computer Programming
  • 33. Second Generation • 1956 - 1963 • Transistor • used to relay and switch electronic signals • Assembly language • Specification • punched cards for input • printouts for output • Transistor for circuits • magnetic core technology for memory • Computers smaller, faster, cheaper, portable and more energy-efficient and need air conditioning. CSEG1001 Computer Programming
  • 35. Third Generations • 1964 – 1970 • Integrated Circuits • Transistors were miniaturized and placed on silicon chips called semiconductors • High Level Language • Specifications • Keyboard as input • Monitor as output • Operating System • Central program that controls the devices • Advantages • Speed • Efficiency • Portable • Cheap • Less power CSEG1001 Computer Programming
  • 37. Fourth Generation • 1970 – Present • Data Communication • Microprocessors • thousands of integrated circuits were built onto a single silicon chip • Properties • Instruction set • Bandwidth • Clock Speed • Example • Intel 4004 chip – minuscule chip(cpu+ memory+ i/p+ o/p unit) • 1984 Apple introduced the Macintosh • Specification • Microprocessor • Mouse and other handheld devices • CPU and ALU • RAID – Redundant array of Independent Disk for memory CSEG1001 Computer Programming
  • 39. Fifth Generation • Present and Beyond • Artificial Intelligence • Game Playing • Expert System • Robotics • Mega chips • Parallel processing • Voice Recognition • Example • No fully AI computers • 1997, an IBM super-computer called Deep Blue defeated world chess champion Gary Kasparov in a chess CSEG1001 Computer Programming
  • 41. Classification of Computers Types of Computers On the basis of Purpose Special Purpose General Purpose On the basis of Technology Analog Digital Hybrid On the basis of Size & Capacity Super Main Frame Mini Micro CSEG1001 Computer Programming
  • 43. Main Frame Computer CSEG1001 Computer Programming
  • 47. Generation of Programming Languages CSEG1001 Computer Programming
  • 49. LECTURE #3 ALGORITHM, FLOWCHARTAND PSEUDOCODE Instructor Dhiviya Rose J . Asst. Prof. Senior Scale School of Computer Science and Engineering | UPES CSEG1001 Computer Programming
  • 50. Software Development Method Execute & Test Finally, the program is tested to verify that it behaves as intended. Coding -------Write Program with some Programming Language C C++ Java …. Modify the solution if necessary Check it Analysis & Design Plan It algorithm flowchart pseudocode PreProgrammingSteps
  • 51. Introduction to Algorithms • The algorithm is the abstract idea of solving a problem. • The algorithm is written in user language
  • 52. Algorithms vs. programs • When an algorithm is coded using any programming language (e.g. C++), then it is called a program. • The program is a set of instructions that can run by the computer.
  • 53. • The algorithm would consist of at least the following tasks: 1- Input (Read the data) 2- Processing (Perform the computation) 3- Output (Display the results)
  • 54. Example 1 • Write a algorithm to find an area of a circle where area = pi * radius * radius Data Processing Output radius area = 3.14 x radius x radius area
  • 55.
  • 56. Flowchart • It is another way to display the algorithm. • Diagram representation – • special geometric symbols connected by lines and contain the instructions.
  • 57. Flowchart Symbols Symbol Function Show the direction of data flow or logical solution. Indicate the beginning and ending of a set of actions or instructions (logical flow) of a module or program. Indicate a process, such as calculations, opening and closing files.
  • 58. Indicate input to the program and output from the program. Use for making decision. Either True or False based on certain condition. Use for doing a repetition or looping of certain steps. Connection of flowchart on the same page. Connection of flowchart from page to page.
  • 59.
  • 60. Pseudocode • Writing the Pseudocode • Pseudocode means an imitation computer code. • It is used in place of symbols or a flowchart to describe the logic of a program. Thus, it is a set of instructions (descriptive form) to describe the logic of a program. • Pseudocode is close to the actual programming language. • Using the Pseudocode, the programmer can start to write the actual code.
  • 61. Structuring a Program • Develop efficient computer solution to problems: 1. Use Modules 2. Use four logic structures a. Sequential structure • Executes instructions one after another in a sequence. b. Decision structure • Branches to execute one of two possible sets of instructions. c. Loop structure • Executes set of instruction many times. d. Case structure • Executes one set of instructions out of several sets. 3. Eliminate rewriting of identical process by using modules. 4. Use techniques to improve readability including four logic structure, proper naming of variables, internal documentation and proper indentation.
  • 63. The Decision Logic Structure • Implements using the IF/THEN/ELSE instruction. • Tells the computer that IF a condition is true, THEN execute a set of instructions, or ELSE execute another set of instructions • ELSE part is optional, as there is not always a set of instructions if the conditions are false. • Algorithm: IF <condition(s)> THEN <TRUE instruction(s)> ELSE <FALSE instruction(s)
  • 67. The Loop Logic Structure • Repeat structure • To solve the problem that doing the same task over and over for different sets of data • Types of loop: • WHILE loop • Do..WHILE loop • Automatic-Counter Loop
  • 70. The Case Logic Structure • Made up of several or many sets of instructions, only one of which will be selected by the user and executed by the computer • Algorithm: CASE OF VARIABLE = constant1: actions for VARIABLE = constant1 = constants2: actions for VARIABLE = constant2 … OTHERWISE: Actions for VARIABLE = anything else END-OF-CASE
  • 73. Example: Biggest of 3 numbers CSEG1001 Computer Programming
  • 74. Example for case structure CSEG1001 Computer Programming
  • 75. Example for Loop CSEG1001 Computer Programming