Ad Code

Responsive Advertisement

Ticker

6/recent/ticker-posts

ALGORITHM IN PROGRAMMING

 

ALGORITHM IN PRGRAMMING

An algorithm is a procedure consisting of a finite number of precisely defined steps for solving a problem.

 example;

 

write a C++ code to add two integers.

The steps that the programmer will be using to write the above code is what we call the ALGORITHM.

Below is the algorithm for the above problem.

1.declare three variables a, b, and c.

2.prompt the user to enter two integers.

3.store the integers in the variables a and b.

4 add a and b.

5.store the answer in the variable c (c=a+ b).

6.display c.

 

TECHIQUES IN LAYING AN ALGORITHM

 

1. Pseudocode

2.flowchart

Pseudocode

 

Pseudocode is a natural language-like statement that describes the steps of an algorithm. It is written such that the desired programming code can be generated from it.

 

FLOWCHART

The flowchart is a diagrammatic representation that depicts the steps and structure of an algorithm.

SYMBOLS OF A FLOWCHART

1.         

terminal      it is used to start or end a flowchart.

2.          Decision     used to evaluate a condition depending on whether a
statement is true or false.

3.          Process      for any internal


operation.

4.         

Input/output       input or output of data.

5.         





Flow lines       determines the direction of the continuation of the program


 


 

 

 

 

 

 

Post a Comment

0 Comments

Ad Code

Responsive Advertisement