Flowchart and algorithem

14
FLOWCART & ALGORITHMS

Transcript of Flowchart and algorithem

FLOW CART & ALGORITHEM

FLOWCART & ALGORITHMS

wahedullah ehsasEhsanullah aydinShoib..... kohee

Group members:1.Ehsanullah Aydin2.Wahedullah Ehsas3.Shuib Kohee

Faculty members:1. kushal D. patel 2. pracnesh A. patel 3. vibhuti p. patel

What is flowchart ?A flowchart is graphical or diagrammatical representation of sequence of any problem to be solved by computer programming language.

How it is useful?It is used to prepare first before writing any program. It is also used to correct and debug a program flow after coding part is completed. 1.flowchart :

Various symbol of flow chart with diagram:Start and stop :

Input/output :

Decision :

Connector :

Loop :

Process or expression representation :

Direction of flow or flow lines :

Flowchart examples :1.Draw a flow chart to find factorial of given number : F=1*2*3*4..N

startReadNF=1I=1Answer :F=4

Process no.2I0Num=num/10sum=sum + r printrvr=,sumTrueFalseNum=1231. r=123 % 10 =3Sum = 0 +3 = 3num = 123/10 =122. r =12 % 10 =2Sum = 0 +2 = 2num = 12/10 =13. r =1 % 10 = 1Sum = 0 +1 = 1 num = 1/10 =0Output :3211) 123>02) 12>03) 1>04) 0>0

Result :Through flow chart it is easy to understand the logic and sequence of problem. After drawing flowchart it becomes easy to write any program.

2.Algorithms : An algorithms is a finite sequence of well defined steps or operations for solving a problem in systematic manner. These are rules for solving any problems in proper manner. Instruction are written in the natural language.

What is algorithms ?

Types of algirithms : Divide and conquerGreedy method Branch and boundRecursioneffectiveness

Pseudo code: It is language or part of language used to convert program into easy form.It allows the programmer to write logic of flowchart or algorithm in symbolic form.

Pseudo code can be used for folowing situation: Storage declarationAssignment of any valueProcedure callInput / outputConstant value

Examples of algorithms :Step 1 : input number : numStep 2 : I =1Step 3 : f =1Step 4 : repeat from step 4 to step 6 until I0Step 4 : calculate r = num % 10 Step 5 : calculate sum = sum * 10 + r Step 6 : calculate num = num / 10Step 7 : print reverse number = ,sumStep 8 : stop

2.Write an algorithm to reverse of given number :