Fundamental of Programming languages

What is Program?

A set of instruction that given to the computer to perform a various types of task is called program. Computer programs are written in programming languages. A person who develop a program is called programmer. A programmer develops program to instruction the computer how to write a program. Before start programming languages need to know about Algorithms&Pseudo Code and Flowchart.

Algorithms & Pseudo Code:

Algorithms is a step-by-step procedure to solve problem. It is a method to develop a program into simple steps.

Properties of Algorithms:

  • The given problem break into the simple and meaningful steps.
  • The steps should be numbered sequence.
  • The steps should be written into written English.

Pseudo Code:

Algorithms are written in a language that is similar to a simple English is called Pseudo Code. It is used to specify the program logic that is independent of any particular programming language.

Pseudo Code simplify program by separating into two parts.

  • Logic Design
  • coding

Logic Design:

Logic of the program is designed. We specify different steps required to solve the problem and the sequence of these steps.

Coding:

In this part, the algorithm is convert into the program. The steps of the algorithms are translate the instructions of any programming languages. The use of pseudo code is allow to a programmer to focus on the planning of the program

There are few examples of Pseudo Code;

Example 1:

write a program that inputs two numbers, and calculates sum and then displays the result on screen.

  1. start
  2. Input A
  3. Input B
  4. Total = A + B
  5. Output
  6. Exit

Example 2:

Write a program that find the sum of first fifty naturals numbers.

  1. Start
  2. sum = 0
  3. N = 0
  4. Repeat Step 5 and 6 While (N <= 50)
  5. sum = sum + N
  6. N = N + 1
  7. Print sum
  8. End

Flowchart:

Flowchart is a combination of Flow and Chart. A chart is consist of different symbols to display information about any program and the flow is the direction of processing that takes place in the program.

Flowchart is a graphical form of algorithm. A programmer prefers to design the flowchart before writing the computer program. Flowchart is designed according to the defined rules.

Flowchart Symbols:

Flowchart uses simple symbols to show different types of statements:

  • Input/Output

Parallelogram symbol is used to represent the input or output step. Input statement is used to get input from the user and the output statement is used to display the message to the user.

  • Process

Rectangular symbol is used to represent the Process step. A process may be a complex calculation or a simple an assignment statement.


 

  • Diamond

A diamond symbol is used to represent the selection. A condition is given in this symbol. The flow of control from diamond maybe go in two directions for Example; one direction if the condition is true and the second direction is if the condition is false.

  • Start/End

An oval symbol is used to represent the start or end.


  • Flow Lines

Arrow symbols are represent the direction of the flow in the flowchart. There are four types of flow lines.


  • Connector

Circle symbol is use to combine different flow lines. It is used when two different direction of flow connect and move in one direction.

  • Preparation

This symbol is used with for loops to specify start and stop conditions.


There are few example of Flowchart:

Example 1:

The Following flowchart represent the steps for adding two numbers.

Example 2:

The following flowchart finds the sum of first 50 natural numbers.

Comments

Popular posts from this blog

What is SEO?

Understanding Programming Languages