Successfully reported this slideshow.
Upcoming SlideShare
×

# Flowchart pseudocode-examples

This is here for c language ,,,flow chart procedures ..10 marks question in uptu btech exam.

• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

### Flowchart pseudocode-examples

1. 1. Introductory Examples of Flowcharts and Pseudocode 1 Chapter 3 Calculate Pay - sequence Start input hours input rate pay = hours * rate print pay End Begin input hours input rate pay = hours * rate print pay End 2 Sum of 2 Numbers - sequence Start input x input y sum = x + y output sum End Begin input x, y sum = x + y print sum End
2. 2. 3 Average of 3 Numbers - sequence Start input x input y input z sum = x + y + z avg = sum / 3.0 print avg End Begin input x input y input z sum = x + y + z avg = sum / 3.0 print avg End 4 Calculate Pay with Overtime - selection input hours, rate hours ≤ 40 pay = hours * rate print pay pay = 40 * rate + (hours - 40) * 1.5 * rate F T Begin input hours, rate if hours ≤ 40 then pay = hours * rate else pay = 40 * rate + (hours – 40) * rate * 1.5 print pay End
3. 3. 5 Average of 10 Numbers – iteration with a while loop i = 0 sum = 0 while i < 10 input x avg = sum / 10.0 sum = x + sum print avg increment i Begin i = 0 sum = 0 while i < 10 input x sum = sum + x ++i avg = sum / 10.0 print avg End F T Begin i = 0 sum = 0 a: if i ≥ 10 goto b input x sum = sum + x ++i goto a b: avg = sum / 10.0 print avg End Comment Strictly speaking, the above flowchart corresponds more to the pseudocode on the right hand side. However, as you can see, ‘gotos’ make code less modular and more unreadable. 6 Average of 10 Numbers – iteration with a for loop sum = 0 i 1 1 10 1 input x sum = x + sum i avg = sum / 10.0 print avg Begin sum = 0 for i = 1 to 10 input x sum = sum + x avg = sum / 10.0 print avg End
4. 4. 7 Flowchart for Function or Subroutine Module Average print “average is”, avg input a, b, c Average sum = a + b + c avg = sum / 3 Exit Begin print “input 3 numbers” input a, b, c End Begin print “Input 3 numbers: ” input a, b, c avg = average(a, b, c) print “Average is ”, avg End Begin Average(a, b, c) sum = a + b + c avg = sum / 3.0 return avg End

### Be the first to comment

• #### YasAhm

Apr. 5, 2016

Nov. 30, 2016
• #### DuaChu

Dec. 11, 2016

Mar. 7, 2017
• #### SupunDilshan

May. 17, 2017
• #### iekarazali

Jun. 30, 2017
• #### AmogelangKanyama

Aug. 29, 2017
• #### SahilRajput33

Dec. 12, 2017
• #### IsaMaris1

Jul. 16, 2018
• #### EmiliaTrafas

Feb. 25, 2019
• #### danieyk

Feb. 24, 2020

This is here for c language ,,,flow chart procedures ..10 marks question in uptu btech exam.

Total views

58,509

On Slideshare

0

From embeds

0

Number of embeds

92

802

Shares

0