Technologies

C

How to write a algorithm?
(adsbygoogle = window.adsbygoogle || []).push({});
# Algorithm has 3 sections :

** Header :** Algorithm Name.

** Declaration : ** A description of variable and their types.

** Algorithm body's :** A Sequenc of algorithm steps.

----------------

----------------

----------------

**Halt**
# Example 1 : Algorithm for adding two numbers

# Example 2 : Algorithm for finding x^{n} for given x and n

# What are the Notations we will use to write an Algorithm?

**Notations :**

Beginning or Ending : Start, Stop

**Input :**Read( variable )

**Example :** Read( var1, var2 )

**Output :** Write ("Test to be displayed", variables)

**Example :** Write("Learning C", var1, var2)

**Comment :** [ Information ]

**Operator :**

**&&, >, <, +, -, *, /, %, and, or, not**
(adsbygoogle = window.adsbygoogle || []).push({});
(adsbygoogle = window.adsbygoogle || []).push({});

CLanguage

Thursday, 10 Aug 2017

1061

0

0

----------------

----------------

----------------

**Start****[ Obtain input values ]**

Read (A, B)**[ Add numbers and store the result ]**

C <- A + B**[ Print result ]**

Write (c)**Stop**

**Start****[ Obtain input value ]**

Read (x, n)**[ initialize result so far ]**

result -> x**[ initialize loop counter ]**

i -> 1**[ Print result ]**

repeat thru step 7 while i < n**[ Recomputed result so far ]**

result <- result * x**( increment counter )**

i <- i + 1**( Display result )**

Write (x, n, result)**( finish )****Halt**

Beginning or Ending : Start, Stop

Post Article

Upload Youtube Video

CLanguage

Thursday, 10 Aug 2017

1061

0

0

Popular Post

- Write an algorithm and draw the flowchart to find the largest number among the three numbers?
- Write an algorithm an draw flowchart to find factorial of a number?
- Write an algorithm and draw the flowchart to find whether a given number is even or odd?
- Write an algorithm and draw the flowchart to Swap two integers?
- Write an algorithm an draw the flowchart to compute the average of the three numbers?
- Write an algorithm and draw the flowchart to find the largest number amoug two numbers?
- write a c program to swap two numbers
- How to write a algorithm?
- What is mean by Operator Precedence and Associativity in C Language?
- C Languages Relational Operators

All contents are copyright of their authors