Function,Algorithm and Flowcharts
The function it is a named block of code that performs some specific task. It got three parts
Function Name: Any valid name can be given.
Argument: If some value is given to the function as input they are called arguments.
Algorithm: In the most simpler way it gives a rough idea of a program by not following and programming language just simple language like English and logic of the program.
E.g. write an algorithm for a program to accept three numbers and find the largest among them
Step-1 Start
Step-2 Insert three numbers
Step-3 Accept three numbers in n1,n2,n3
Step-4 Compare n1>n2 and n1>n3
Step-5 If true display n1 is the largest
Step-6 If false compare n2>n1 and n2>n3
Step-7 If true display n2 is the largest
Step-8 If false display n3 is the largest
Step-9 Stop
Flowchart: Its a graphical representation of an algorithm
Sorry, I cannot give the notations here due to copyright stuff so please use google.
Here is an example of flowchart made using Lucidchart by myself
one correction there are arrows between accept input and r
- Return type
- function name
- arguments
Function Name: Any valid name can be given.
Argument: If some value is given to the function as input they are called arguments.
Algorithm: In the most simpler way it gives a rough idea of a program by not following and programming language just simple language like English and logic of the program.
E.g. write an algorithm for a program to accept three numbers and find the largest among them
Step-1 Start
Step-2 Insert three numbers
Step-3 Accept three numbers in n1,n2,n3
Step-4 Compare n1>n2 and n1>n3
Step-5 If true display n1 is the largest
Step-6 If false compare n2>n1 and n2>n3
Step-7 If true display n2 is the largest
Step-8 If false display n3 is the largest
Step-9 Stop
Flowchart: Its a graphical representation of an algorithm
Sorry, I cannot give the notations here due to copyright stuff so please use google.
Here is an example of flowchart made using Lucidchart by myself
one correction there are arrows between accept input and r
Comments
Post a Comment
Feel free to leave a comment...