0% found this document useful (0 votes)
153 views

Flowchart and Algorithm

The document defines an algorithm as a well-defined set of steps to solve a problem on a computer. It notes that the earliest known algorithms were developed by the Arab mathematician Al-Khowarizmi. The document then lists the key properties of an algorithm as input, output, definiteness, fineness, and effectiveness. It provides examples of algorithms to add two numbers, find the largest of three numbers, calculate an average, and represents them in pseudocode and flowchart form.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
153 views

Flowchart and Algorithm

The document defines an algorithm as a well-defined set of steps to solve a problem on a computer. It notes that the earliest known algorithms were developed by the Arab mathematician Al-Khowarizmi. The document then lists the key properties of an algorithm as input, output, definiteness, fineness, and effectiveness. It provides examples of algorithms to add two numbers, find the largest of three numbers, calculate an average, and represents them in pseudocode and flowchart form.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Algorithm

A well defined set of steps for solving any problem on the


computer.

Arab Mathematician : Al - Khowarizmi

Programming in C - Algorithm and Flowchart : Instructor - Ms. Anita C 1


Properties of an Algorithm

1. Input
2. Output
3. Definiteness
4. Fineness
5. Effectiveness

Programming in C - Algorithm and Flowchart : Instructor - Ms. Anita C 2


Algorithm
To add two numbers entered by user.

Step 1: Start
Step 2: Declare variables num1, num2 and sum.
Step 3: Read values num1 and num2.
Step 4: Add num1 and num2 and assign the result
to sum.
sum←num1+num2
Step 5: Display sum
Step 6: Stop

Programming in C - Algorithm and Flowchart : Instructor - Ms. Anita C


3
Algorithm
To find the largest among three different numbers entered by user.

Step 1: Start
Step 2: Declare variables a, b and c.
Step 3: Read variables a, b and c.
Step 4: If a>b
If a>c
Display a is the largest number.
Else
Display c is the largest number.
Else
If b>c
Display b is the largest number.
Else
Display c is the greatest number.
Step 5: Stop Programming in C - Algorithm and Flowchart : Instructor - Ms. Anita C 4
Algorithm
To display Average of a set of given numbers.
1. Start
2. Declare variables n, i, x, sum
3. Read the value of n.
4. Initialize i = 1 , sum = 0
5. if i > n go to 10
6. Read the value of x.
7. sum = sum + x
8. i = i + 1
9. go to 5
10.average = sum / n
11.Display average.
12.Stop
Programming in C - Algorithm and Flowchart : Instructor - Ms. Anita C 5
Flowchart

A graphical representation of an algorithm, often


used in the design phase of programming to work
out the logical flow of a program.

Programming in C - Algorithm and Flowchart : Instructor - Ms. Anita C


6
Programming in C - Algorithm and Flowchart : Instructor - Ms.
7
Anita C
Sum of two
numbers

Programming in C - Algorithm and Flowchart : Instructor - Ms. Anita C 8


Area of a
circle

Programming in C - Algorithm and Flowchart : Instructor - Ms. Anita C 9


Average of three numbers

Programming in C - Algorithm and Flowchart : Instructor - Ms. Anita C 10


Programming in C - Algorithm and Flowchart : Instructor - Ms. Anita C 11
Largest of three numbers

Programming in C - Algorithm and Flowchart : Instructor - Ms. Anita C 12


Sum of first 50 numbers

Programming in C - Algorithm and Flowchart : Instructor - Ms. Anita C 13

You might also like