0% found this document useful (0 votes)
3 views1 page

algorithm

An algorithm is a systematic method for solving problems, often used in data processing and mathematical operations. Good algorithms should have clearly defined inputs and outputs, unambiguous steps, and be effective without relying on specific programming code. Examples provided illustrate algorithms for adding two numbers and finding the largest among three numbers.

Uploaded by

rajukh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
3 views1 page

algorithm

An algorithm is a systematic method for solving problems, often used in data processing and mathematical operations. Good algorithms should have clearly defined inputs and outputs, unambiguous steps, and be effective without relying on specific programming code. Examples provided illustrate algorithms for adding two numbers and finding the largest among three numbers.

Uploaded by

rajukh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 1

Algorithm

An algorithm is a step by step method of solving a problem. It is commonly used for data
processing, calculation and other related computer and mathematical operations.
An algorithm is also used to manipulate data in various ways, such as inserting a new data item,
searching for a particular item or sorting an item.
Qualities of a good algorithm
1. Input and output should be defined precisely.
2. Each step in algorithm should be clear and unambiguous.
3. Algorithm should be most effective among many different ways to solve a problem.
4. An algorithm shouldn't have computer code. Instead, the algorithm should be written in
such a way that, it can be used in similar programming languages.

Example:

Write an 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

Write an 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

You might also like