Introduction to Programming (ECS 102)
Instructors:
Dr. Jasabanta Patro and Dr. Rini Smita Thakur
Introductory Concepts
Introduction to Computers!
●You will find them in many different forms.
○Massive Servers
○Workstations, Desktops, Laptops
○Tablets/Smartphones
COMPUTER CHARACTERISTICS
●All digital computers, regardless of their size, are basically electronic devices
that can transmit, store, and manipulate information (i e., data).
○Numeric data, -> common data type
○Character data (names, addresses, etc.) -> common data type
○Graphic data (charts, drawings, photographs, etc.), and
○sound (music, speech patterns, etc.).
●To process a particular set of data, the computer must be given an
appropriate set of instructions called a program.
●These instructions are entered into the computer and then stored in a portion
of the computer’s memory.
COMPUTER CHARACTERISTICS
COMPUTER CHARACTERISTICS
Memory
●Every piece of information stored within the computer’s memory is encoded
as some unique combination of zeros and ones.
●These zeros and ones are called bits (binary digits).
●Each bit is represented by an electronic device that is, in some sense, either
“off’ (zero) or “on” (one).
Memory
Memory
Memory: Bytes and Words
●Large computers have memories that are organized into words rather than
bytes. Each word will consist of a relatively large number of bits-typically 32
or 36.
Memory: Bytes and Words
Memory: Bytes and Words
Memory: Auxiliary storage devices
●Types:
○Magnetic Tapes
○Disks (HDDs, SSDs)
○Optical memory devices (CDs, DVDs etc.)
●They can store higher amount of information (In GBs)
Speed and Reliability
●Because of its extremely high speed, a computer can carry out calculations
within minutes that might require many days, perhaps even months or years, if
carried out by hand.
○For example, the end-of-semester grades for all students in a large university can typically be
processed in just a few minutes on a large computer
●The time required to carry out simple computational tasks, such as adding
two numbers, is usually expressed in terms of microseconds or
nanoseconds.
MODES OF OPERATION
●Batch Processing
○A number of jobs are entered into the computer, stored internally, and then processed
sequentially.
●Time-sharing
○Timesharing allows many different users to use a single computer simultaneously.
●Interactive Computing
○In an interactive computing environment, the user and the computer interact with each other
during the computational session.
INTRODUCTION TO C
●C was originally developed in the 1970s by Dennis Ritchie at Bell Telephone
Laboratories, Inc. It is a general-purpose, structured programming language.
●Its instructions consist of terms that resemble algebraic expressions,
augmented by certain English keywords such as if, else, for, do and while.
●C also contains certain additional features, however, that allow it to be used at
a lower level, thus bridging the gap between machine language and the more
conventional high-level languages.
INTRODUCTION TO C
●This flexibility allows C to be used for systems programming (e.g., for writing
operating systems) as well as for applications programming (e.g., for writing
a program to solve a complicated system of mathematical equations, or for
writing a program to bill customers).
●C is characterized by the ability to write very concise source programs, due in
part to the large number of operators included within the language.
●It has a relatively small instruction set, though actual implementations include
extensive library functions which enhance the basic instructions.
Structure of a C Program
●Every C program consists of one or more modules called functions.
●One of the functions must be called ‘main’.
●The program will always begin by executing the main function, which may
access other functions.
Points to be noted.
Points to be noted.
Points to be noted.
Points to be noted.
SOME SIMPLE C PROGRAMS
●Each program calculates the area of a circle,
●Each program illustrates a somewhat different approach to this problem