An Algorithm is the set of well-defined instruction in a sequence to solve a given problem in a programming language.

An Algorithm should always have a clear starting and stopping point.

Qualities of a good algorithm

  • The Input and output should be precisely defined.
  • Each step in an algorithm should be clear & unambiguous.
  • An algorithms should be effective among many different ways to solve & execute a problem.
  • An algorithm should not have computer code, Instead the algorithm should be written in such a manner that it can be used in co-similar programming languages.

Examples Of Algorithm In Programming

  1. Write an algorithm to add two numbers entered by user.

Step-1: Start

Step-2: Declaration of the variables number1, number2 & sum.

Step-3: Read the values of number1 and number2.

Step-4: Add number1 & number2 & assign result to the sum.

i.e. sum=number1+number2

Step-5: Display the sum.

Step-6: Finally Stop.

2) Write an algorithm to find the greatest among the three different numbers entered by user.

Step-1: Start

Step-2: Declaration of the variables m,n & p.

Step-3: Read the values of variables m,n & p.

Step-4: Check is a>b,

is a>c,

Display that a is the largest number.

Otherwise

Display that c is the largest number.

Otherwise

is b>c,

Display that b is the largest number.

Otherwise

Display that c is the greatest number.

Step-5: Stop.

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

©2023 MYBSCIT.com. An initiative by some failures to make student scholars.

or

Log in with your credentials

Forgot your details?