Upcoming SlideShare
×

# Pseudocode-Flowchart

65,383 views

Published on

12 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• it help a lot. tq ;)

Are you sure you want to  Yes  No
• WAW

Are you sure you want to  Yes  No
• sir g python ni mil rhi

Are you sure you want to  Yes  No
• a big help for me .. thanks a lot

Are you sure you want to  Yes  No
• that is very very niceeeeeeee

Are you sure you want to  Yes  No
Views
Total views
65,383
On SlideShare
0
From Embeds
0
Number of Embeds
272
Actions
Shares
0
1,134
5
Likes
12
Embeds 0
No embeds

No notes for slide

### Pseudocode-Flowchart

1. 1. PSEUDOCODE and FLOWCHART<br />
2. 2. Pseudocode (pronounced SOO-doh-kohd)<br />is a detailed yet readable description of what a computer program or algorithm must do, expressed in a formally-styled natural language rather than in a programming language. Pseudocode is sometimes used as a detailed step in the process of developing a program. It allows designers or lead programmers to express the design in great detail and provides programmers a detailed template for the next step of writing code in a specific programming language.<br />
3. 3. Sample 1<br />Election Control Structures<br />If age &gt; 17<br /> Display a message indicating you can vote.<br />Else<br /> Display a message indicating you can&apos;t vote.<br />End<br />
4. 4. Sample 2<br />Iteration (Repetition) Control Structures<br />count assigned zero<br />While count &lt; 5<br /> Display &quot;I love computers!&quot;<br /> Increment count<br />End while<br />
5. 5. Sample 3<br />Pseudo-code the task of computing the final price of an item after figuring in sales tax. <br />Note the three types of instructions: input (get), process/calculate (=) and output (display)<br />Note that the operations are numbered and each operation is unambiguous and effectively computable. We also extract and list all variables used in our pseudo-code. This will be useful when translating pseudo-code into a programming language<br />
6. 6. Computing Sales Tax<br />1.         get price of item<br />2.         get sales tax rate<br />3.         sales tax = price of time times sales tax rate<br />4          final prince = price of item plus sales tax<br />5.         display final price<br />6.         end<br /> <br />Variables: price of item, sales tax rate, sales tax, final price<br />
7. 7. Sample 4<br />Computing Weekly Wages<br />Gross pay depends on the pay rate and the number of hours worked per week. However, if you work more than 40 hours, you get paid time-and-a-half for all hours worked over 40. Pseudo-code the task of computing gross pay given pay rate and hours worked.<br />
8. 8. Code<br />1.         get hours worked<br />2.         get pay rate<br />3.         if hours worked ≤ 40 then<br /> 3.1       gross pay = pay rate times hours worked<br />4.         else<br />            4.1       gross pay = pay rate times 40 plus 1.5 times pay rate times (hours worked minus 40)<br />5.         display gross pay<br />6.         halt<br />  variables:  hours worked, ray rate, gross pay<br />This example introduces the conditional control structure. On the basis of the true/false question asked in line 3, we execute line 3.1 if the answer is True; otherwise if the answer is False we execute the lines subordinate to line 4 (i.e. line 4.1). In both cases we resume the pseudo-code at line 5.<br />
9. 9. Flowchart<br />A flowchart is a diagrammatic representation that illustrates the sequence of operations to be performed to get the solution of a problem. Flowcharts are generally drawn in the early stages of formulating computer solutions. Flowcharts facilitate communication between programmers and business people. These flowcharts play a vital role in the programming of a problem and are quite helpful in understanding the logic of complicated and lengthy problems. Once the flowchart is drawn, it becomes easy to write the program in any high level language. Often we see how flowcharts are helpful in explaining the program to others. Hence, it is correct to say that a flowchart is a must for the better documentation of a complex program.<br />
10. 10. Basic Symbols<br />Rounded box - use it to represent an event which occurs automatically. Such an event will trigger a subsequent action, for example `receive telephone call’, or describe a new state of affairs.<br />Rectangle or box - use it to represent an event which is controlled within the process. Typically this will be a step or action which is taken. In most flowcharts this will be the most frequently used symbol.<br />Diamond - use it to represent a decision point in the process. Typically, the statement in the symbol will require a `yes&apos; or `no&apos; response and branch to different parts of the flowchart accordingly.<br />Circle - use it to represent a point at which the flowchart connects with another process. The name or reference for the other process should appear within the symbol.<br />
11. 11. GUIDELINES FOR DRAWING A FLOWCHART<br />Flowcharts are usually drawn using some standard symbols; however, some special symbols can also be developed when required.<br />Start or end of the program<br />Computational steps or processing function of a program<br />Input or output operation<br />Decision making and branching<br />Connector or joining of two parts of program<br />Magnetic Tape<br />Off-page connector<br />Flow line<br />Annotation<br />Display<br />
12. 12.
13. 13. Draw a flowchart to find the largest of three numbers A,B, and C.<br />
14. 14. Draw a flowchart to find the sum of first 50 natural numbers.<br />