Programming Basic
Programming Basic
[3.0 Credits]
Introduction to Programming
Languages
Block of a Computer:
Input Processing Output
History of Computers:
The early inventions was Chinese abacus.
Charles Babbage’s “Analytical engine” (1834).
Computers in Society:
Advantages and Disadvantages
Scripting languages.
Clarity
The overall readability of the program, with particular emphasis on its underlying
logic.
Simplicity
The clarity and accuracy of a program are usually enhanced by keeping things as
simple as possible.
Efficiency
Concerned with execution speed and efficient memory utilization.
Modularity
Programs can be broken down into a series of identifiable subtasks.
Generality
Program to be as general as possible, within reasonable limits.
MAH, CSE, FEC
Structured Programming
Encompasses a number of methodologies to produce good quality
design and code, which can be
Easily understood
Tested
Debugged
Modified
Maintained in future
Main Principles
Program design (top-down or button-up approach)
Decomposition of program into components
Structuring of control flow (Sequence, Selection, Iteration)
Design
(algorithm, flow chart)
Coding
(programming languages)
Running
(verify its correctness)
Documentation
(further use)
Keywords
Certain reserved words (int , for , char , if )
Only 32 standard keywords
Some compilers may include more 8 keywords
Identifiers
Names that are given to various program elements (variables, function)
char
Single character
1 byte
float
Floating-point number (number containing a decimal point)
2 words (4 bytes)
double
Double-precision floating-point number
4 words (8 bytes)
Escape Sequences:
\n, \a, \\, \t etc.
Variables:
All variables must be declared before use.
int a, b; char flag; float root1, root2;
Statements:
Expression statements, Compound statements, Control statements
Symbolic Constants:
#define name text ( #define PI 3.1415)
Step 1: Start
Step 2: Declare variables A, B and Sum.
Step 3: Read values A and B
Step 4: Add A and B and assign the result to Sum.
Sum = A + B
Step 5: Display Sum.
Step 6: Stop.
Symbols Used: