Imperative Programming
Imperative Programming
Imperative
Programming
RONNIE V. EDEC
Introduction
Imperative Programming is used by the most
professional programmers in their day-to-day jobs
or business.
Commands
Execution and
flow of control
Similar to the machine
instructions
Basis for defining an
effective programming
language
Turing Completeness
A programming language is said to be Turing Complete if it
contains
- Integer variables, values and operations
- Assignments, branching, sequencing, and conditionals
Other features make languages easier to program for
complex applications
- Loops
- Procedures
- Object Orientation
But they have the same power as any other
programming language
-i.e. what is possible to compute in one is possible in the
other
- Jay is Turing Complete
Other Features
Structured Programming
The structure of the program text
should be the
guide to understanding what it does.
Can be more efficient Benefits
Improved readability
Easier to tune and modify Offer more services
Save cash
Efficiency
A language must allow an underlying Offer better services
assignment-oriented machine to be used
directly and efficiently.
Driving factor in the implementation of many
imperative languages
Types in Typical Imperative
Languages
Skipping
in Text
01 Boolean
02 Integer
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char *argv[])
{ int sum, count, n;
count = 0;
sum = 0;
while (1 == scanf("%d\n", &n))
{ sum = sum + n;
count++;
}
printf("%f\n", (float)sum / (float)count);
exit(0);
}
Thank You