Documentos de Académico
Documentos de Profesional
Documentos de Cultura
UNIT-1 (Study Material) Syllabus: UNIT-1 Introduction to Computers: System Software, Program Developing Steps, Algorithms, Flowcharts. Introduction to C: Structure of C Program, Variable Names, Data Types, Constants, Operators, Type Conversions, Expressions, Precedence and Order of Evaluation. Managing I/O: Input-Output Statements, Formatted I/O. Computer System : A computer is a components: l. Computer Hardware II. Computer Software system made up of two major
Computer Software : Software is the collection of that allow the hardware to do its job. There are two types of Computer Software. A. System Software B. Application Software The following figure shows the Computer Software.
Programs ( instructions )
System Software consists of programs that manage the hardware resources of a computer and perform required information processing tasks. Application Software is directly responsible for helping users to solve their problems.
Computer Languages : To write a program for a computer, we must use Computer Language. The following figure shows the summary of Computer Languages.
The
following are A. B. C.
the
Machine Languages Symbolic Languages High - level Languages developed. techniques The careful makes the
System Development : It tells how a program is design of each program using structured development program efficient , error-free and easy to maintain.
System Development Life Cycle: Modern programming projects are built using a series of interrelated phases commonly referred to as System Development Life Cycle. Depending on the type of life cycle the number of phases changes. Most popular one is Waterfall model. The following figure shows the Waterfall model.
Running Programs : It is the job of programmer to write program. The following are four steps for creating and running A. B. C. D. Writing and Editing the Program Compiling the Program Linking the Program with the required library modules Executing the Program shows the various steps in building a C program
The
following
figure
Program follows.
Development
is
multi
step process
as
Understand the Problem Develop a Solution - Algorithm - Pseudo code - Flowchart Write a Program Test it
Pseudo-code: Pseudo-code is part English, part program logic. Its purpose is to describe, in precise algorithmic detail , what the program being designed is to do. This requires defining the steps to accomplish the task in sufficient detail so that they can be converted into a computer program . It was made up of 2 words : pseudo and code. Pseudo means imitation and code refers to instructions, written in a programming language. It does not obey the syntax rules of any particular language. It is not real programming code. Keywords for writing Pseudo-code
READ , OBTAIN , GET PRINT , DISPLAY , SHOW COMPUTE , CALCULATE , DETERMINE SET , INIT INCREMENT , BOMP instructions that , it followed
Algorithm : Algorithm is a finite set of accomplishes a particular task. Program = Algorithm + Data
Algorithm should satisfy the following criteria 1. Input : Zero or more quantities are externally supplied. 2. Output : At least one quantity is produced. 3. Definiteness : Each instruction is clear and unambiguous. Ex Add B or C to A 4. Finiteness : Algorithm should terminate after finite number of steps when traced in all cases Ex: Go on adding elements to an array 5. Effectiveness: Every instruction must be basic i.e., it can be carried out, by a person using pencil and paper. Ex: Algorithm for adding two numbers Step 1: Start Step 2: Read A, B Step 3: C A+B Step 4 : Display C Step 5: Stop Structures : Two - Way Selection If - else : if condition True alternative else False alternative end if Example: if A > B then Write ( A ) else Write ( B ) end if Nested - if : if condition True alternative if condition True alternative else False alternative end if else False alternative endif Example: Finding the maximum of three numbers using Nested - if : Read ( A , B , C ) if A > B then if A > C then max A else max C end if else if B > C then max B else max C end if end if
Decision
Decision Structure :
Multi - Way Selection. select ( expression ) from case case val1 : val2 : statements ; default : endselect statements ;
repeat while Read numbers from keyboard & print total. Start Sum 0 Read num repeat thru step 6 while num > 0 Sum Sum + num Read num Write Sum Stop
for used if number of repetitions are known before. repeat range of loop for values of loop _control_ variable. Factorial of a Given Number
Example: 1. 2. 3. 4. 5. 6. 7.
Start Read N fact 1 for i 1 to N in step 1 do 4.1 fact fact * i endfor Write factorial of N is , fact Stop
Flowchart :A flowchart is a visual representation of the sequence of steps for solving a problem . A flowchart is a set of symbols that indicate various operations in the program. For every process , there is a corresponding symbol in the flowchart . Once an algorithm is written , its pictorial representation can be done using flowchart symbols. In other words, a pictorial representation of a textual algorithm is done using a flowchart.
Purpose :
The first flowchart is made by John Von Neumann in 1945. It is a symbolic diagram of operations sequence, dataflow, control flow and processing logic in information processing. The symbols used are simple and easy to learn. It is a very helpful tool for programmers and beginners.
Advantages :
Provides Communication Provides an Overview Shows all elements and their relationships Quick method of showing Program flow Checks Program logic Facilitates Coding Provides Program revision Provides Program documentation
Limitations :
Flowchart is an important aid in the development of an algorithm itself Easier to Understand than a Program itself Independent of any particular programming language Proper documentation Proper debugging Easy and Clear presentation
Complex logic Drawing is time consuming Difficult to draw and remember Technical detail
Primary Symbols :Programmers use Primary Symbols to show the instructions or actions needed to solve the problem presented in the algorithm. With these Symbols , it is possible to represent all the three structured programming constructs Sequence , Decision and Repetition Statements. l. ll lll. Sequence Statements