flowcharts

48
Q.1 Draw a Flowchart to add 100 odd nos. Q.2 Draw a flowchart to add the following series 1, 11, 111, 1111, -------- 10 Nos. Q.3 Draw a flowchart to add sum of square Q.4 Draw a flowchart to add following series of first 20 odd nos. 2,5,10,17,26,------- 10 nos. START SUM = 0 C = 0 A =1 SUM = SUM + A C= 10 ? A = A*10+1 PRINT SUM START START SUM = 0 C = 0 A =1 SUM = SUM + A C= 100 ? A = A+2 PRINT SUM START SUM = 0 C = 0 A =1 SUM = SUM + (A*A+1) SUM = 0 C = 0 A =1 SUM = SUM + A*A PRINT SUM START START START C = C+1 A = A+2 C = C+1 A = A+2 C = C+1 A = A+2 C = C+1 A = A+2

Upload: alemnewyimam

Post on 06-Aug-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Flowcharts

Q.1 Draw a Flowchart to add 100 odd nos. Q.2 Draw a flowchart to add the following series

1, 11, 111, 1111, -------- 10 Nos.

Q.3 Draw a flowchart to add sum of square Q.4 Draw a flowchart to add following series

of first 20 odd nos. 2,5,10,17,26,------- 10 nos.

START

SUM = 0

C = 0

A =1

SUM = SUM + A

C= 10

?

A = A*10+1 PRINT

SUM

START

START

SUM = 0

C = 0

A =1

SUM = SUM + A

C= 100

?

A = A+2PRINT

SUM

START

SUM = 0

C = 0

A =1

SUM = SUM + (A*A+1)

C= 10

?

A = A+1 PRINT

SUM

START

SUM = 0

C = 0

A =1

SUM = SUM + A*A

C= 20

?

A = A+2 PRINT

SUM

START

STARTSTART

C = C+1

A = A+2C = C+1

A = A+2

C = C+1

A = A+2C = C+1

A = A+2

Page 2: Flowcharts

Q.5 Draw a flowchart to add the following series

1,1,2,3,5,8,13, -------- 10 nos. This series is known as fabonaci series.

Q.6 Draw a flowchart to print the sum of square of following series.

3, 5, 10, 17, 26, 37, ---------- 10 terms

START

SUM = 0

C = 0

A =1

B =0

SUM = SUM + T

C= 10

?

A = B

B = T

PRINT

SUM

END

T = A+B

START

SUM = 9

C = 1

A =2

SUM = SUM + (A*A+1)

C= 10

?

A = A+1

PRINT

SUM

END

C = C+1

A = A+2

C = C+1

A = A+2

Page 3: Flowcharts

Q.7 Draw flowcharts for following series Q.8 Draw flowcharts for following series

1A + 2 A2 + 3 A3 + 4A4 + ……..N Terms

START

SUM = 0

C = 1

B =A

SUM = SUM + T

C= N

?

C = C+1

B = B * A

PRINT

SUM

END

T = C*B

INPUT

A, N

START

SUM = 0

C = 1

A =1

SUM = SUM + T

C= N

?

C = C+1

A = A+1

PRINT

SUM

END

T = A/(A+1)*(A+2)

INPUT

N

Page 4: Flowcharts

Q.9 Draw flowcharts for following series Q.10 Draw a Flowchart to sum up the following

1A - 2 A2 + 3 A3 - 4A4 + ……..N Terms series.

1.3/2.4.5 + 2.4/3.5.6 + 3.5/4.6.7 +---N terms

START

SUM = 0

C = 1

B =A

SUM = SUM + T

C= N

?

C = C+1

B = B * (-A)

PRINT

SUM

END

T = C*B

INPUT

A, N

START

SUM = 0

C = 1

A =1

SUM = SUM + T

C= N

?

C = C+1

A= A+1

PRINT

SUM

END

T = A*(A+2)/(A+1)*(A+3)*(A+4)

INPUT

N

Page 5: Flowcharts

Q.12 Draw a Flowchart to find the value of K!

Q. 13 Draw a Flowchart to find the value of KN

START

M=1

A =K

A= 1

?

A=A-1

PRINT

M

END

M=M*A

INPUT

K

START

M=1

A =K

C = 1

C= N

?

C=C+1

PRINT

M

END

M=M*A

INPUT

K, N

Page 6: Flowcharts

Q.14 Draw a flowchart of which will calculate the sum of the first N multiples of an integer K

i.e. 1x K + 2 x K + 3 x K + ---------------- + N x K

Q. 15 Draw a flowchart for computing annual acquisition, inventory carrying and total costs for lot

sizes of 100, 200 ……… 2400. The various variables of interests are supposed to be there in the

locations symbolized below:

REQ Annual Requirements of Item

ACQ Procurement costs/order

COST Cost Per Unit

RATE Inventory carrying Rate, I

START

SUM =0

C =1

A = 1

C= N

?C =C + 1

A = A+1

PRINT

SUMEND

SUM = SUM + A*K

INPUT

K, N

START

LOTSIZE = 100

LOTSIZE

=

2400 ?

LOTSIZE = LOTSIZE + 100

END

OC = (REQ/LOTSIZE)*ACQ

READ

REQ, ACQ, COST,

RATE

CC = ((LOTSIZE)/2)*COST*RATETC= OC+CC

PRINT

LOTSIZE, OC, CC,

TC

Page 7: Flowcharts

Q.16 Draw a flowchart for finding the amount of an annuity of Rs. A in N years , Rate of Interest = r %,

R = 1+ r, this amount is given by following series:

A + AR + AR2 + AR3 + ………. ARN-1

START

SUM =0

C =1

R = 1+ r

C= N

?

C =C + 1

A = A*R

PRINT

SUM

END

SUM = SUM + A

INPUT

A, r, N

P= D

?

P = (P + D) / 2

PRINT

P

END

START

P = N/2

D = N / P

INPUT

N

Page 8: Flowcharts

Figure: Square root of a Number

Q. Draw a flowchart to find the sixteenth rot of a no.

P= D

?

P = (P + D) / 2

PRINT

P

END

START

P = N/2

D = N / P

INPUT

N

C= 4

?

C = C + 1

N = P

C =1

Page 9: Flowcharts

Q.16 Draw a flowchart for finding the sum of the following given series.

8 x 5 + 10 x 8 + 12 x 11 + 14 x 14 +…………….

Add the terms from the above series till the sum value will not exceed 5000. Print the sum and

number of terms taken from the series.

YES

START

SUM = 0

C = 1

A =8

B = 5

SUM = SUM + A*B

SUM > 5000

?

Page 10: Flowcharts

Q.17 Draw a flowchart for computing and printing the simple interest for 10,12,13, and 14 years at the

rate of 3% per annum on an investment of Rs. 10,000.

Q.18 Assume that you opened a savings account with a local bank on 1-1-2004. the annual interest rate

is 5%. Interest is compounded at the end of each month. Assuming that your initial deposit is X rupee,

draw a flowchart to print out the balance of your account at the end of each month for two years.

A = A+2

B = B + 3

C = C+1PRINT

SUM, C

END

SUM = SUM-A*B

C = C-1

P = 10000

R = 3%

T = 10

START

START

READ

X

Page 11: Flowcharts

Q. 19 Draw a flowchart the read a number of positive data values ( a negative data value will indicate

the end of the data value set) and print the difference between the largest and smallest of the all data

values read.

I = P*R*T

T = 14

?

T = T +1

PRINT

I

END

R = 5%

C= 1

I = (X*R) / 12

X = X +I

C= 24

?

C =C +1

PRINT

X

END

A < 0 ?

START

INPUT

A

B

Page 12: Flowcharts

Logical Flowcharts:

Q.1 Draw a flowchart to calculate the commission of a sales representative based on the following set of rules.

(i) if the sales is less than Rs. 5000, there is no commission.

(ii) if the sales is Rs. 5000 or above but less than Rs. 50000, then the commission is computed @ 10% of the

sales.

(iii) if the sales is Rs. 50000 or above, the commission Rs. 5000 and @ 12% of the sales above Rs. 50000.

Print the sales and commission.

PRINT

D

END

H = A

L = A

H = A

D = H- L

INPUT

A

A < 0 ?

A > H ?

A < L ?

L = A

B

START

Page 13: Flowcharts

COMM: Commission

Q.2 The XYZ Company follows the following procedure for dealing with delivery charges for goods

sold. For the purpose of determining delivery charges, customer are divided into two categories, those

whose sales region code is 30 or above, and those with sales region code of less than 30

(A) If the code is less than 30 and invoice amount is less than Rs. 15000, the delivery charge is Rs.

300. If the invoice value is Rs. 15000 or more, the delivery charge is Rs. 150.

SALE <

=5000

?

PRINT

SALES, COMM

END

INPUT

SALE

COMM = 0

SALE <

=50000

?

COMM = SALE *.10

COMM = 5000+ (SALE-

50000 ) *.12

MORE

TRANS.

?

Page 14: Flowcharts

(B) If the sales region code is equal to or greater than 30 and invoice total is less than Rs. 15000/- the

delivery charge is Rs. 400/- For invoices totaling Rs. 15000 or more, the delivery charge is Rs.

200/-

Prepare a flow chart to find out and print delivery charges

IV : Invoice Value

DC : Delivery Charges

Q.3 ABC India Ltd. has different types of items to sell to different types of customers. In order to promote its

sale, discount is given as per the following procedure. (May 2004)

CODE

<30

?

PRINT

DC

START

INPUT

CODE, IV

DC = 300DC = 200

MORE

TRANS.

?

IV <

15000

?

IV <

15000

?

DC = 150DC = 400

END

Page 15: Flowcharts

(i) A discount of 12% is allowed on Washing Machines irrespective of the class of customers and value

of the order.

(ii) On cooking range, a discount of 12 % is allowed to Dealers and 9% to Retailers irrespective of the

value of order.

(iii) On decorative products, Dealers are allowed a discount of 20% provided the value of order is 10000

or above. Retailers are allowed a discount of 10% irrespective of the value of the order.

Draw a flowchart to calculate discount for above procedure.

TI : Type of Items

TC : Type of Customers

OV: Order Value

D : Discount in %

Q.4 An electricity distribution company has three category of consumers. (May 2003)

TI =

“Washing

Machine”

?

PRINT

D

START

INPUT

TI, TC, OV

D = 12%

DC = 200

MORE

TRANS

?

TI =

“Cooking

Range”

? TC =

“Dealer

?

D = 10%

DC = 400

END

TC =

“Dealer

?OV <

10000

?

D =

Page 16: Flowcharts

(i) Domestic (ii) Commercial (iii) Industry

The charges of per unit consumed by these consumers are Rs. 3, Rs. 4 and Rs.5 respectively. The computer database of

company provide following information (Consumer’s Name, Category, Units Consumed, Bill Date and Date of Payment) The

company process the bills according to following criterion.

If consumer is domestic and pay his bill within 10 days of bill date 5% discount is given. If he pays within 15 days no

discount is given. If he makes the payment after 15 days of bill date, 10% surcharge is levied. For non domestic consumers

corresponding percentages are 10%, 0% and 15% respectively.

Draw a flowchart to calculate the Bill Amount, Discount, Surcharge and Net Amount of bill for each consumer and print the

same.

CN : Consumer’s Name

CT : Consumer Category

OV : Units Consumed

BD : Bill Date

DP : Date of Payment

ND : No. of Days for Bill Payment

D : Discount in Rupees

S : Surcharge in Rs.

BA : Bill Amount

NA : Net Bill Amount

CT =

“Domestic

” ?

PRINT

BA, D, S, NA

START

READ

CN, CT, UC, BD, DP

D = 0

S = 0

ND = DP-BD

D = 0

MORE

TRANS.

?

CT =

“Industry”

?

ND <

=10

?

BA = U*3

D = BA * .05

END

S = BA*.1

ND <

=15

?

BA = U * 5 BA = U * 4

ND <

=10

?

ND <

=15

?

D =0

D = BA *.1

S = BA *.15 NA = BA – D + S

Page 17: Flowcharts

Q.5 An Insurance company follow the following rules: (Nov. 2002)

(i) If a person’s health is good and age in between 20 and 40 years and lives in city and sex is male, then the premium is Rs.

20 per thousand and he will be insured for maximum amount of Rs. 10 Lakhs.

(ii) If a person satisfies all the above conditions, except sex is female, then the premium is Rs. 15 per thousand and maximum

insured sum will be Rs. 15.0 Lakhs.

(iii) If a person’s health is poor and age is between 20 and 40 years, but lives in a village. For a male sex premium is Rs. 50

per thousand and maximum insured sum is Rs. 10 Lakh only.

(iv) In all other cases the person is not to be insured.

Draw a flowchart to find eligibility of person to be insured, premium rate and maximum amount of insurance.

AGE : Age of Customer

S : Sex, Male or Female

H : Health, Good or Poor

PL : Place of Living, City or Village

IP : Insurance Premium Rs. /Thousand

MI : Maximum Insurance Rs. Lakhs

NO

YES YES YES YES

NO NO NO

YES

NO

NO

YES

YES NO

Q. 6 A bank accept the fixed deposit for a year or more and the policy on interest is as follows. (Nov. 2003)

(i) If a deposit is less than Rs. 10000 and for two or more years, the interest rate is 5% compounded annually.

Age =

“Between 20

and 40” ?

PRINT

IP, MI

READ

AGE, S, H, PL

MORE

TRANS

?

H =

“Good”

?

PL=

“City” ?

END

S =

“Male”

?

S =

“Male”

?

START

A

PL=

“City” ?A

A

A

A

IP = Rs. 50 / Th

MI = 1 Lakh

IP = Rs. 15 / Th

MI = 1 Lakh

IP = Rs. 15 / Th

MI = 1 Lakh

IP = Rs. 50 / Th

MI = 1 Lakh

Page 18: Flowcharts

(ii) If a deposit is Rs. 10000 or more, but less than Rs. 50,000 and for two or more years the interest rate is 7%

compounded annually.

(iii) If deposit is Rs. 50000 or more and is for one year or more the interest rate is 8% compounded annually.

(iv) On all deposits for 5 years or more interest rate is 10% compounded annually.

(v) On all other deposits not covered by the above conditions, the interest rate is 3%.

(vi) If the customer is holder of any type of account for last five years, an additional 1% interest is allowed.

Draw a flowchart to obtain the money in customer’s account and interest credited at the time of withdrawal.

DP : Deposit Period

DA : Deposit Amount

AHP : Account Holding Period

R : Rate of Interest

I : Interest Amount Credited

TA : Total Amount at withdrawal

YES

NO

NO

YES

Q. 7Draw a flowchart to calculate the net discount allowed (In %) to customers by company based on the following policy.

Quantity Ordered Normal Discount

DP > =

“5 Years”

?

PRINT

I , TA

READ

DP, DA, AHP

MORE

TRANS

?

DP > =

“2

Years” ?

END

DA<

10000?

DP > =

“1

Years” ?

TA = DA*(1+R)TP

I = TA -DP

START

R = 10%

DA<

50000?

R = 5%

R = 7%

R = 8%DA > =

50000? R = 8%

PRINT

“No Deposit Accepted”A

R = 3%

AHP >=

“5

Years”? R = R +1%A

Page 19: Flowcharts

1-99 5%

100-200 7%

201-499 9%

500-1000 10%

More than 1000 20%

These discounts are reduced or increased if the customer’s account balance is below Rs. 5000 and does not have any

have any balance in the account older than 3 months. If customer does not satisfy both the conditions the discount is

reduced by 2%. If one condition is violated, the discounts are reduced by 1%. If a customer has been trading with

the company for over 5 years and conforms to both the above checks, then he is allowed an additional 1% discount.

Q : Quantity Ordered

AB : Amount Balance in Account

BP : Account Balance Time

Period

TP : Trading Time With Company

YES

NO

Q.8Pepsi India Ltd sells soft drinks to three types of sales outlet

(a) Super Markets and Large departmental Store (b) Retailers (c) Hotel and Catering Establishments

Depending upon the sales outlet and value of sales, the discounts are officered as per the followings chart.

Q<100 ?

PRINT

I , TA

READ

Q, AB, BP, TP

MORE

TRANS

?

END

AB

<5000

?

START

R = 10%

TP >

“5

Years”

R = 5%

D = D – 2%D = D – 1%

D = D + 1%

Q<=200

?

R = 5%Q<500 ?

R = 5%Q<=1000

?

R = 5%

BP <

3Mon

th

BP <

3Mont

h

Page 20: Flowcharts

Order Value Discount Offered

Super Market Retailers Hotels & Catering

< Rs. 5000 5% 3% 4%

5000 to Less than 10000 8% 7% 7.5%

For Rs. 10000 and above 10% 10% 10%

Prepare a Flowchart to find out and print the discount offered.

TC : Type of Customer

OV : Order Value

D : Discount Offered

YES

NO

NO

YES

Q.9 There are 100 employees working in a company, it is required to prepare a report of people who are likely to retire in the

current financial year. The following information will be supplied for each employee of the company (i) Name (ii) Age (iii)

Code ( Code = 1 if no extension of service is given and code = 2 extension of service is given if person reach at the age of 58)

Any employee who reach at the age of 58 or more in current financial year will retire subject to above conditions.

Draw a program flowchart to compute and print:

(a) Name of the employee who is retiring and

(b) Number of employee who will continue in the service for next financial year.

OV > =

10000 ?

PRINT

D

READ

TC, OV

MORE

TRANS

?

OV>=50

00 ?

END

TC =

“Super

Market” ?TC=

“Super

Market” ?

START

D = 10%

TC=

“Retailer

” ?

50000?

D = 8%

D = 7%

D = 7.5%TC=

Retailer”

?

D = 3%

D = 4%

D = 5%

Page 21: Flowcharts

Q.10The following information will be provided during a program execution for 100 employees..

(i) Name (ii) Basic Salary (iii) Dearness Allowance (iv) Type of Employee (P for Permanent and T for Temporary employees).

Draw a Flowchart to compute and print the following for each employee,

(i) Name (ii) Gross Salary (iii) Net Salary

Where Gross Salary = Basic Salary + DA + HRA

HRA = 30 % of Basic Salary

Net Salary = Gross Salary – Deductions

START

INPUT

NAME, CODE, AGE

E = 1

N = 0

AGE >

= 58 ?

CODE

= 1 ?N = N+1

N = N+1

PRINT

NAME

E =

100 ?

E = E+1

PRINT

N

END

Page 22: Flowcharts

Deductions = PF + TDS , Where PF = 12% of Basic Salary (for Permanent employee only) TDS is calculated as follows:

Monthly Gross Salary TDS

upto 10000 Nil

10001 to 15000 5% of Gross Salary

15001 to 25000 10 % of Gross Salary

>25000 20% of Gross Salary

BS : Basic Salary

DA : Dearness Allowance

TE : Type of Employee

HRA: House Rent Allowance

GS : Gross Salary

NS : Net Salary

DED : Deductions

Q.11 The Gross monthly remuneration of a Company’s salesman comprises a basic salary and certain additional payments

and bonuses as follows: Salesman with over 10 years service receive a 10 percent addition to their basic salary each month.

Bombay salesmen receive an additional allowance of Rs. 1000/- per month.

Monthly Bonus payments are made and calculated as follows.

Monthly Sales Bonus as % of monthly salesRs. 0-50000 0.5%

START

E = 1

INPUT

NAME, BS, DA, TE

HRA = .30 * BS

GS = BS + DA + HRA

TE =

“Permanent”

?PF = 0 PF = 0.12*BS

GS <=

10000?

GS <=

15000?

GS <=

25000?

TDS = 0

TDS = .05*GS

TDS = 0.1*GS

PF = 0.2*GS

DED = PF+TDS

NS = GS - DED

PRINT

NAME, GS, NS

E = 100?E = E + 1

END

Page 23: Flowcharts

50001-100000 1.0%

above Rs. 100000 1.5%

DAF to find out the gross monthly remuneration of a salesman.

BS : Basic Salary

SP : Service Period

PS : Place of Service

MS : Monthly Sales

SPA : Service Period Allowance

BA : Bombay Allowance

MSA: Monthly Sales Allowance

GR : Gross Monthly Remuneration

Q.12 ABC company has eight sales offices all over Delhi. Each office sells 5 different products of the company. The product

master file contains the following information for each product of each sales office.

(1) Opening Stock (2) Sale (3) Receipt From Factory

Draw a flowchart to Calculate and print

1. Total closing stock of each sales office

START

INPUT

BS, SP, PS, MS

SP >

“10

Years” ?SPA = 0 SPA = 0.1 * BS

PS =

“Bombay”

?BA = 0 BA = 1000

MS < =

50000

?

MS < =

100000 ?

MSA = 0.005*MS

MSA = 0.01*MS

MSA = 0.015*MS

GR = BS + SPA + BA + MSA

PRINT

GR

MORE

TRANS ?

END

Page 24: Flowcharts

2. Total closing stock of entire company

O : Office No.

TCS : Total Closing Stock of company

P : Product No.

OCS : Office Closing Stock

OS : Opening Stock of Product

R : Receipt of Product from Factory

S : Sale of Product

PCS : Product Closing Stock.

Q.13 : A bank has 500 employees. The salary paid to each employee is sum of his Basic Pay, Dearness Allowance and House

Rent Allowance. For the purpose computing house rent allowance bank has classified his employees into three classes A, B

and C. The House Rent Allowance for each class is computed at the rate of 30 percent, 20 percent and 10 percent of the basic

pay respectively. The Dearness Allowance is computed at flat rate of 60% of Basic Pay.

START

O = 1

TCS = 0

P = 1

OCS = 0

INPUT

OS, R, S

PCS = OS + R - S

OCS = OCS + PCS

P = 5?

P = P +1

PRINT

OCS

TCS = TCS + OCS

O = 8 ?

O = O +1

PRINT

TCS

END

Page 25: Flowcharts

Draw a flowchart to determine the percentage of employees falling in the each of following salary slab:

(i) Above Rs. 30,000

(ii) Rs. 15,001 to Rs. 30,000

(iii) Rs. 8,001 to Rs. 15, 000

(iv) Less than or equal to Rs. 8,000 (May: 2005)

Q.14 Draw a Flowchart to print 10 nos. in Ascending Order.

START

E = 1

C1 =0, C2 =0

C3 =0, C4 =0

INPUT

BP, DA, CE

CE = “A”

?

CE = “B”

?

HRA = .0.30 * BP

HRA = .0.20 * BP

HRA = .0.20 * BPSP = BP + DA + HRA

SP >

30000 ?C1= C1+1

SP >

15000 ?C2= C2+1

SP > 8000 ? C3= C3+1

C4= C4+1

E=500

?

E = E +1

P1 = C1/5

P2 = C2/5

P3 = C3/5

P4 = C4/5

PRINT

P1, P2, P3, P4

START

START

X = 1

S =0

INPUT

J(X)

X = 1 TO 10

J(X) >

J(X+1)

?

SWITCH J(X)

WITH (J(X+1)

S = S+1

X =

9 ?X = X+1

S =

0 ?

PRINT

J(X)

X = 1TO 10END

Page 26: Flowcharts

FOR SWITCH J(X) WITH J(X+1)

WE CAN USE ALSO

R = J(X)

J(X) = J(X+1)

J(X+1) =R

Page 27: Flowcharts

Q. 15 The weights of newly born babies in a hospital are input to computer. The hospital in charge is interested to find the

maximum, minimum and mean weights of all the weights of babies. Draw a flowchart for this problem and a value of zero

for weight can be used as end of flowchart.

W = Weight Input

MAXW = Maximum Weight

MINW = Minimum Weight

MEANW = Mean Weight

TOTW = Total Weight C = Counter for Counting No. of Babies

PRINT

MAXW, MINW,

MEANW

END

START

MAXW = W

MINW = W

TOTW = W

INPUT

W

MAXW = W

MEANW = TOTW / C

INPUT

W

W =

0 ?

W >

MAXW

? ?

W <

MINW

?

MINW = W

C = 1

TOTW = TOTW + W

C = C + 1

Page 28: Flowcharts

Q.16 A company has many customers and for every customer following information is kept in database.

Account No., Name, Age, Sex and Unpaid Balance of Customer. Draw a flowchart to computer and print the total unpaid

balance for Males and Females under following categories.

(i) Age Under 20

(ii) 20 to under 30

(iii) 30 to under 40

(iv) 40 and over

ACN : Account No. of Customer

NAME: Name of Customer

AGE : Age of Customer

S : Sex of Customer Male or Female

UB : Unpaid Balance

M1, M2, M3 and M4 for four age group

Male Balances

F1, F2, F3 and F4 for four age group

female Balances

START

M1 =0, M2 =0

M3 =0, M4 =0

F1 =0, F2=0

F3 =0, F4 =0

INPUT

ACN, NAME

AGE, S, UB

S =

“Male” ?

AGE <

20?

M1=M1 + UBAGE <

20?

MORE

TRANS ?

PRINT

M1, M2, M3, M4

F1, F2, F3, F4

END

F1=F1+ UB

AGE <

30?M2=M2 + UBAGE <

30?F2=F2+ UB

AGE <

40?M3=M3 + UBAGE <

40?F3=F3+ UB

M4=M4 + UBF4=F4+ UB

Page 29: Flowcharts

Q.16 A company has many customers and for every customer following information is kept in database.

Account No., Name, Age, Sex and Unpaid Balance of Customer. Draw a flowchart to computer and print the AVEARGE

UNPAID BALANCE for followings.

(i) Male

(ii) Female

(iii) Total

ACN : Account No. of Customer

NAME: Name of Customer

AGE : Age of Customer

S : Sex of Customer Male or Female

UB : Unpaid Balance

FB : Total Female Balance

MB : Total Male Balance

TB : Total Balance

MN : Total no. of Males

FN : Total No. of Females

AFB : Average Female Balance

AMB : Average Male Balance

AOB : Average Overall Balance

MN =0, FN =0

MB =0, FB =0

INPUT

ACN, NAME

AGE, S, UB

S =

“Male” ?

MN = MN + 1

MB = MB + UB

MORE

TRANS ?

PRINT

AMB, AFB, AOB

END

FN = FN + 1

FB = FB + UB

END

AMB = MB / MN

AFB = FB / FN

TB = MB + FB

TN = MN + FN

AOB = TB / TN

Page 30: Flowcharts

Q.18 Draw a flowchart to compute and print 50 transactions (Assuming all are correct)

The Gross Sales (GS) , Discount Allowed (DA) and Net Sales (NS)

The input document shall provide the Quantity Sold (QS) and Unit Price (UP). The discount is allowed as under.

No. of Units sold Discount admissible

Less than 100 Nil

100-200 2%

201-500 5%

501-1000 10%

More than 1000 20%

It should also be noted that 25 transactions must be printed on one page. Suitable headings such as Gross Sales,

Discount Allowed, and Net Sales must be printed on every page.

P : Page No. (From 1 to 2)

T : Transaction No. (1 to 25 on

each page)

YES

NO

Q<100 ?

READ

QS, UP

T =

25?

D = GS*0

D = GS*.02Q<=200

?

D = GS*.05Q<=500

?

D = GS*.1Q<=1000

?

D = GS*.2

START

P = 1

T = 1

NS = GS - D

PRINT

HEADINGS

GS = UP*QS

PRINT

HEADINGS

P=2?

25?T = T + 1

Page 31: Flowcharts

Q.19 : Draw a flowchart to compute and print income tax and surcharge on the income of person, where income is to be read

from terminal and tax is to be calculated as per the following rates.

Up to Rs. 1,00,000 No Tax

Up to Rs. 1,50,000 @10% amount above Rs. 1,00,000

Up to Rs. 3,00,000 @ 20% of amount above Rs. 1,50,000

Above Rs. 3,00,000 @ 30% of amount above Rs. 3,00,000

Charge surcharge @ 5 % of total amount of tax, if the income of a person exceeds Rs. 5,00,000 and @ 10% if income of a

person exceed Rs. 10,00,000.

Q.20 : A Nationalized Bank has the following policy to its depositors:

On deposits of Rs. 5,000 or above and for three years and above, the interest payable is 10%, on deposit for the same anount

and for less than three years, the interest is 8% and on deposits below Rs. 5000, the interest rate is 7% irrespective of the

period.

Draw a flowchart to compute the interest for the above given information and print the same.

P = P + 1

END

Page 32: Flowcharts

Some Miscellaneous Flowchart:

Q.1 Wages of 500 workers are held in J(W), W = 1,2,3……..500. Draw a program flowchart the print the frequency

distribution (i.e. no. of workers) in each of followings categories.

(i) < 300 There are total 8 categories among which workers will be distributed

(ii) 300 < 400 therefore, we will take different variable for representing these 8

(iii) 400 < 500 categories, from F1 to F8

(iv) 500 < 600

(v) 600 < 700

(vi) 700 < 800

(vii) 800 < 900

(viii) > = 900

NO

J(W)<30

0?

READ J (W)

W = 1 TO 500

F1 = F1 +1

F2 = F2 +1J(W)<40

0?

F3 = F3 +1J(W)<50

0?

F4 = F4 +1J(W)<60

0?

F8 = F8 +1

W =1

START

F5 = F5 +1J(W)<70

0?

J(W)<80

0?

J(W)<90

0?

W

=500 ?

F7 = F7 + 1

F1 =0, F2 =0, F3 =0

F4 =0, F5 =0, F6 =0

F7 =0, F8 =0

Page 33: Flowcharts

Q.2 Out of an array of number J(N), N = 1,2…….100, 5 numbers are known to be zeros. You have to draw the program

flowchart for squeezing the zeros out i.e. rearrange the 95 non – zeros number in location J(N). N = 1,2,……95.

Also, extend the flowchart for printing these 95 numbers in a 19 x 5 matrix: assume that a number is at most of six digits.

C : For Column Position

I : For Nos. in One row (1 to 5)

F6 = F6 + 1

F7 = F7 + 1

PRINT

F1, F2, F3, F4

F5, F6, F7, F8

END

READ J (N)

N = 1 TO 100

START

N = 1

K = 0

J(N) =

0 ?

K = K +1

J(K) = J(N)

PRINT J(N)

N = 1 TO 95

C = 1

I = 1

PRINT

J(N) AT C

N =1

I = 5 ?

C = C + 8

I = I + 1

N = N +1 1 LINE FEEDN = 95 ?

N = N + 1 END

Page 34: Flowcharts

Q.3 J(E), E = 1,2…….42 contains 42 quantities of 7 x 6 matrix. Draw the program flowchart for printing its transpose;

assume that a number is at most of 5 digits.

Transpose means 7 x 6 matrix will changed to 6 x 7 matrix

C : For Printing Column Position

I : For Nos. in one row (1 to 7)START

READ

J(E),

E = 1 TO 42

E = 1

J = 1

C =1

I = 1

PRINT

J(E) AT C

I = 7 ?

I = I + 1

C = C+ 7

E = E + 6

J = J + 1

1 LINE FEED

E =

42 ?

J = J + 1

E = J END

Page 35: Flowcharts

Q . 5 Names of eleven cricket players are held in J(X), X = 1,3,5,………21 and their respective batting average in J(X),

X = 2,4,6,……..22. You are required to arrange the eleven players in descending order of their batting average.

FOR SWITCH J(X) WITH J(X+1)

WE CAN USE ALSO

R = J(X)

J(X) = J(X+2)

J(X+2) =R

START

X = 2

S =0

INPUT

J(X)

X = 1,3,…21

X =2,4,…22

J(X) <

J(X+2)

?

SWITCH J(X)

WITH (J(X+2)

AND

SWITCH

J(X-1) WITH

J(X+1)

X = 20

?

X = X+2 S =

0 ?

S = S+1

Page 36: Flowcharts

Q.6 J(X), X = 1,2 ……..200 designate numbers, Draw the program flowchart for computing the followings:

1. The % ages of negative, zero and positive numbers

2. The of the –ve and +ve numbers separately

3. The sum of the absolute number

4. The sum of squares of all the number

s

PRINT

J(X)

X = 1,3,…21

X =2,4,…22

END

START

X= 1

P =0, N=0, Z =0

SP =0, SN =0

SA =0, SS =0

INPUT

J(X)

X = 1 TO 200

J(X) > 0

?

P = P +1

SP = SP + J(X)J(X) = 0

?

Z =Z + 1

N = N +1

SN = SN + J(X)

SA = SA + ABS(J(X)

SS = SS + J(X) * J(X)X

=200 ?X = X+1

P = P / 2

N = N / 2

Z = Z / 2

PRINT

P, N, Z

SP, SN

SA, SSSTART

Page 37: Flowcharts

INPUT

N