0% found this document useful (0 votes)
17 views4 pages

Lab Theory Contents

Uploaded by

noorainswahab29
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views4 pages

Lab Theory Contents

Uploaded by

noorainswahab29
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Introduction to C Programming:

Computer is an electronic device that is designed to accept data, perform the required
mathematical and logical operations at high speed and output the result.
A computer is a fast and accurate electronic machine that is designed to accept and store input
data, process them and produce output results by using the instructions of a stored program or
data.
A computer has some important features that make it different from a human.
The word computer brings from the word ‘compute’, that means to ‘calculate’.
The function performed by a PC is execution of program.
A computer understands ‘Binary’ language only.
It produces 100 percent exact and accurate results.
Charles Babbage is considered as the father of the computer and he was an English
mathematician and inventor.
Problem Solving Techniques:
The process of working through details of a problem to reach a solution. There are three
approaches to problem solving:
Algorithm
Flowchart
Pseudo Code
Algorithm: The algorithm is a step-by-step procedure to be followed in solving a problem. It
provides a scheme to solve a particular problem in finite number of unambiguous steps. It
helps in implementing the solution of a problem using any of the programming languages.
In order to qualify as an algorithm, a sequence of instructions must possess the following
characteristics:
Definiteness: Instructions must be precise and unambiguous i.e. each and
every
instruction should be clear and should have only one meaning.
Finiteness: Not even a single instruction must be repeated infinitely. i.e.,
each
instruction should be performed in finite time.
Termination: After the algorithm gets executed, the user should get the
desired result
Key features of an algorithm:
Any algorithm has a finite number of steps and some steps may involve decision
making, repetition. Broadly speaking, an algorithm exhibits three key features that can be
given as:
Sequence: Sequence means that each step of the algorithm is executed in the specified
order.
Decision: Decision statements are used when the outcome of the process depends on
some condition.
Repetition: Repetition which involves executing one or more steps for a number of
times can be implemented using constructs like the while, do-while and for loops.
These loops executed one or more steps until some condition is true.

Example: To compute the Area of Rectangle


ALGM: AREA_of_RECTANGLE [This algorithm takes length and breadth, the
sides of the rectangle as input and computes the area of rectangle using the formula
area=length * breadth. Finally it prints the area of rectangle]
STEPS:
Step 1:[Initialize]
Start
Step 2: [Input the sides of Rectangle]
Read length, breadth
Step 3:[Compute the area of rectangle]
Area=length*breadth
Step 4:[Display the Area]
Print Area
Step 5: [Finished]
Stop

Flowcharts: A flowchart is a graphical or symbolic representation of an algorithm. They are


basically used to design and develop complex programs to help the users to visualize the
logic of the program so that they can gain a better understanding of the program and find
flaws, bottlenecks, and other less-obvious features within it.Basically, aflowchart depicts the
“flow” of a program. The following table shows the symbols used in flowchart along with its
descriptions.

Advantages of Flowcharts:
A flowchart is a diagrammatic representation that illustrates the sequence of steps that
must be performed to solve a problem. They are usually drawn in the early stages of
formulating computer solutions to facilitate communication between programmers and
business people.
Flowcharts help programmers to understand the logic of complicated and lengthy
problems.
They help to analyze the problem in a more effective manner
Flowchart can be used to debug programs that have error(s).
Limitations of using Flowcharts:
Drawing flowcharts is a laborious and a time consuming activity.
Flowchart of a complex program becomes, complex and clumsy. At times,
alittle bit of alteration in the solution may require complete re-drawing of the
flowchart
Essentials of what is done may get lost in the technical details of how it is done.
There are no well defined standards that limits the details that must be
incorporated in a flowchart

Write the following practice programs executed in lab along with outputs.
Practice Programs
1. Program to perform Addition
2. Program to perform division
3. Calculation of Simple Interest
4. Area of Rectangle

You might also like