Flowcharts
Flowcharts
Flowcharts
Q.2 Draw a flowchart to add the following series 1, 11, 111, 1111, -------- 10 Nos.
START SUM = 0 C=0 A =1
C = C+1 A = A+2
C = C+1 A = A+2
SUM = SUM + A
SUM = SUM + A
C= 100 ?
C= 10 ?
A = A+2
PRINT SUM
A = A*10+1
PRINT SUM
START
START
Q.3
Q.4
C = C+1 A = A+2
C = C+1 A = A+2
C= 20 ?
C= 10 ?
A = A+2
PRINT SUM
A = A+1
PRINT SUM
START
START
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.
START SUM = 0 C=0 A =1 B =0
C = C+1 A = A+2
T = A+B
SUM = SUM + T
C= 10 ? PRINT SUM
A=B B=T
END
Q.6
Draw a flowchart to print the sum of square of following series. 3, 5, 10, 17, 26, 37, ---------- 10 terms
START SUM = 9 C=1 A =2
C = C+1 A = A+2
Q.7
START
INPUT A, N
INPUT N
SUM = 0 C=1 B =A
SUM = 0 C=1 A =1
T = C*B
T = A/(A+1)*(A+2)
SUM = SUM + T
SUM = SUM + T
C= N ?
C= N ?
C = C+1 B=B*A
PRINT SUM
C = C+1 A = A+1
PRINT SUM
END
END
Q.9
Q.10 Draw a Flowchart to sum up the following series. 1.3/2.4.5 + 2.4/3.5.6 + 3.5/4.6.7 +---N terms
START
START
INPUT A, N
INPUT N
SUM = 0 C=1 B =A
SUM = 0 C=1 A =1
T = C*B
T = A*(A+2)/(A+1)*(A+3)*(A+4)
C= N ?
C= N ?
C = C+1 B = B * (-A)
PRINT SUM
C = C+1 A= A+1
PRINT SUM
END END
INPUT K
M=1 A =K
M=1 A =K C=1
M=M*A M=M*A
A= 1
? PRINT M A=A-1
C= N
? PRINT M C=C+1
END
END
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
START
INPUT K, N
SUM =0 C =1 A= 1
LOTSIZE = 100
LOTSIZE PRINT LOTSIZE, OC, CC, = OC = (REQ/LOTSIZE)*ACQ LOTSIZE = LOTSIZE + 100 TC ? 2400 CC = ((LOTSIZE)/2)*COST*RATE TC= OC+CC
END
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 START INPUT A, r, N
INPUT N
SUM =0 C =1 R = 1+ r
P = N/2
C= N
? PRINT SUM
P= D
? PRINT P P = (P + D) / 2 END END
C =C + 1 A = A*R
INPUT N
C =1
P = N/2
D=N/P
P= D
?
C= 4
P = (P + D) / 2 ? C=C+1 N=P PRINT P END
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.
START
YES
PRINT SUM, C
END
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.
START
START
P = 10000 R = 3% T = 10
READ X
R = 5% C= 1
I = P*R*T
I = (X*R) / 12 X = X +I
PRINT I
PRINT X
T = 14 ?
C= 24 ?
T = T +1 C =C +1 END END
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.
START
INPUT A
A<0
?
H =A L=A
INPUT A
A< 0
?
D = H- L
PRINT D
B
END
A> H
?
H=A
A< L
?
L=A
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.
START
INPUT SALE
COMM = 0
MORE TRANS. ?
COMM: Commission
END
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.
(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
START
INPUT CODE, IV
CODE <30
?
IV < 15000
?
IV < 15000
?
DC = 200
DC = 400
DC = 150
DC = 300
PRINT DC
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)
(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.
START
TI = Washing Machine
?
D = 12%
TI = Cooking Range
?
TC = Dealer
?
D = 10%
TC = Dealer
?
DC = 400
OV < 10000
?
DC = 200
D=
PRINT D
(May 2003)
(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 (Consumers 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.
START
CT = Domestic ?
CN : Consumers 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
BA = U*3
D = BA * .05
BA = U * 5
D=0
ND < =10 ?
D = BA *.1
D =0
NA = BA D + S
PRINT BA, D, S, NA
Q.5 An Insurance company follow the following rules: (Nov. 2002) (i) If a persons 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 persons 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.
START
READ AGE, S, H, PL
NO
A
YES
H= Good
?
NO YES YES
YES
S= Male ?
NO
A PL= City ?
NO
NO
S= Male ?
YES
IP = Rs. 50 / Th MI = 1 Lakh
IP = Rs. 50 / Th MI = 1 Lakh
PRINT IP, MI
YES
MORE TRANS ?
NO
END
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. (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 customers account and interest credited at the time of withdrawal.
START
DP : Deposit Period
DA : Deposit Amount AHP : Account Holding Period R : Rate of Interest I : Interest Amount Credited TA : Total Amount at withdrawal YES
R = 10%
DP > = 5 Years ?
NO
DP > = 2 Years ?
NO
DP > = 1 Years ?
YES
DA< 10000?
R = 5%
DA< 50000?
R = 7%
DA > = 50000?
R = 8%
R = 8% R = 3%
R = R +1%
MORE TRANS ?
PRINT I , TA
TA = DA*(1+R)TP I = TA -DP
END
Q. 7Draw a flowchart to calculate the net discount allowed (In %) to customers by company based on the following policy. Quantity Ordered Normal Discount 1-99 5% 100-200 7% 201-499 9% 500-1000 10% More than 1000 20% These discounts are reduced or increased if the customers 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.
START
Q : Quantity Ordered
AB : Amount Balance in Account BP : Account Balance Time TP : Trading Time With Company
Period
Q<100 ?
YES
R = 10%
Q<=200 ?
NO
R = 5%
Q<500 ?
R = 5%
Q<=1000 ?
D = D 1%
MORE TRANS ?
PRINT I , TA
TP > 5 Years
D = D + 1%
END
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. 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.
START
TC : Type of Customer
OV : Order Value D : Discount Offered
READ TC, OV
OV > = 10000 ?
YES
D = 10%
NO
NO
D = 8%
D = 7%
TC= Retailer ?
D = 7.5%
D = 3% D = 4% D = 5%
PRINT D
MORE TRANS ?
END
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.
START
E=1 N=0
AGE > = 58 ?
N = N+1
END
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 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 START
E=1
BS : Basic Salary DA : Dearness Allowance TE : Type of Employee HRA: House Rent Allowance GS : Gross Salary NS : Net Salary DED : Deductions
TE = Permanent ? PF = 0 PF = 0.12*BS
GS <= 10000?
TDS = 0
TDS = .05*GS
Q.11 The Gross monthly remuneration of a Companys 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 sales Rs. 0-50000 0.5% 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 START PS : Place of Service MS : Monthly Sales INPUT SPA : Service Period Allowance BS, SP, PS, MS BA : Bombay Allowance MSA: Monthly Sales Allowance GR : Gross Monthly Remuneration
SP > 10 Years ? SPA = 0 SPA = 0.1 * BS
PS = Bombay ? BA = 0 BA = 1000
MS < = 50000 ?
MSA = 0.005*MS
MS < = MSA = 0.01*MS 100000 ? MSA = 0.015*MS MORE PRINT GR = BS + SPA + BA + MSA TRANS ? GR END
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 2. Total closing stock of entire company
START
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.
P = 5? PRINT OCS
P = P +1
O = O +1
END
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. 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)
(May: 2005)
CE = A ?
HRA = .0.30 * BP
CE = B ?
HRA = .0.20 * BP
SP > 30000 ?
C1= C1+1
C2= C2+1 E=500 C3= C3+1 E ? E +1 C4= C4+1 = P1 = C1/5 P2 = C2/5 PRINT P3 = P3, P1, P2,C3/5P4 START P4 = C4/5
INPUT J(X) X = 1 TO 10
X=1 S =0
FOR SWITCH J(X) WITH J(X+1) WE CAN USE ALSO R = J(X) J(X) = J(X+1) J(X+1) =R
SWITCH J(X) WITH (J(X+1) S = S+1
X= 9? S= 0?
X = X+1
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.
START
INPUT W
= Weight Input = Maximum Weight = Minimum Weight = Mean Weight = Total Weight = Counter for Counting No. of Babies
C=1
INPUT W
W= 0?
MEANW = TOTW / C
W> MAXW ?
?
END MAXW = W
W< MINW ?
MINW = W
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
START
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
F2=F2+ UB
M2=M2 + UB
F3=F3+ UB F4=F4+ UB
M3=M3 + UB M4=M4 + UB
MORE TRANS ?
END
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
END
MN =0, FN =0 MB =0, FB =0
S= Male ?
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
FN = FN + 1 FB = FB + UB
MN = MN + 1 MB = MB + UB
MORE TRANS ?
END
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.
START P=1
PRINT HEADINGS
T=1
READ QS, UP
YES
D = GS*0
Q<=200 ?
NO
D = GS*.02
D = GS*.2
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.
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 START (v) 600 < 700 (vi) 700 < 800 F1 =0, F2 =0, F3 =0 (vii) 800 < 900 F4 =0, F5 =0, F6 =0 (viii) > = 900
F7 =0, F8 =0
W =1 J(W)<30 0?
NO 0? 0?
F1 = F1 +1
F2 = F2 +1
J(W)<50 0?
F3 = F3 +1
F4 = F4 +1
J(W)<70 0?
F5 = F5 +1
F6 = F6 + 1
F7 = F7 + 1
F7 = F7 + 1
END
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.
START
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
START
READ J(E), E = 1 TO 42
E=1 J=1
C =1 I=1
PRINT J(E) AT C
E= 42 ?
J=J+1 E=J
END
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.
START INPUT J(X) X = 1,3,21 X =2,4,22
X=2 S =0
FOR SWITCH J(X) WITH J(X+1) WE CAN USE ALSO R = J(X) J(X) = J(X+2) J(X+2) =R
SWITCH J(X) WITH (J(X+2) AND X = SWITCH 20 ? J(X-1) WITH X = X+2 J(X+1)
S= 0S+1 S= ?
END
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
START
INPUT J(X) X = 1 TO 200 X= 1 P =0, N=0, Z =0 PRINT SP =0, SN =0 P, N, Z SA =0, SS =0 PSP,P / 2 = SN J(X) = 0 X J(X) > 0 NSA, SS2 =N/ N = N +1 SA = SA + ABS(J(X) P = P +1 ? =200 ? ? START Z + J(X) Z + J(X) X = X+1 SN = SN + J(X) = SS =Z + 1 * J(X) SP = SP = Z / 2 SS
INPUT N