ALGORITHM/FLOWCHART/PROBLEMSOLVING/LECTURE-6

Algorithm

Ø  An algorithm is step by step execution of program .
Ø  It is written in simple  English language.
Ø  Easy to understand
Ø  An algorithm is used to understand the logic of program

FEATURES:
Ø  An algorithm must follow a sequence that is one step followed by the another step.
Ø  Decision:  you can use decision statement for taking decisions
Ø  Repetition: you can also use it to reapeat a particular statement

EXAMPLES:
1.       START                                                  
 Read input A&B                         
 C=A+B                         (SUM OF TWO NUMBERS)
 Display C
 END

FLOWCHART


What is flowchart?

A flowchart is the graphical rrepresntation of program. A flowchart is the collection of conventional symbols. These symbols are


Drawbacks
1.       >Time consuming process
2.       >Flowchart of complex is complex
  >No well defined standard

Problem solving

In problem solving process it is necessary to find out the problem & take necessary actions.
In computer programming it is a systematic approach to find the solution of a problem & implement it
There are two techniques to solve a problem
1.       Algorithm
2.       Flowchart

·        Different phases to solve a problem


1.       >Defining the problem: in this phase we define the problem according to our objective
2.       >Analyzing the problem: in this phase all the possibilities for decision making has verified
3.       >Designing a program: algorithm and flowchart of optional solution is to be designed
4.       >Coding a program: syntax is written
5.      >Testing a program: > correctness > reliability
>  Maintaining a program
(for further reference)

HOMEWORK:
       
     write algorithms for the following:
  • to calculate sum of three numbers
  • to calculate average of three numbers
  • to check whether a person is eligible to vote or not 
  • to swap 2 numbers (with and without third variable)
  • to print largest number among three numbers
  • to calculate the roots of the equation
  • to check whether a number is even or odd from 100 numbers
  • to check the working of repetition statement
                (for solutions click here) 

Comments

Popular Posts