English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

write an algorithm for the following question: 1)Bharath borrowed Rs.20,000 partly from a friend at 12% SI and the remaining from the bank at 15% SI. At the end of 2 years, he paid back an amount of Rs.25,700. What is the amount that he borrowed from the bank?

2007-01-01 18:56:53 · 6 answers · asked by Anonymous in Science & Mathematics Mathematics

6 answers

Let BT = borrowed amount total
BB = borrowed from bank
BF = borrowed from friend

BT = BB + BF = 20000
Repaid amount = BF (1+ .12)^2 + BB(1+.15)^2 = 25700

BB = 20000 - BF

Substitute this into the repaid amount equation:

BF(1+.12)^2) + (20000 - BF)(1+.15)^2 = 25700

Solve for BF, then for BB

2007-01-01 19:06:49 · answer #1 · answered by mattmedfet 3 · 0 0

The algorithm should come first, not after the programming, because it's easier. Since you have the code already written, you could simply summarize each line, and that would give you an algorithm, but that's not really the point The idea is to start with a succinct summary of the problem steps in English and then translate those steps into whatever language you're using. I'll resist giving you an algorithm for the specific problem (because bless you - you didn't ask for it) Instead, I'll illustrate with another common CS1 problem so you can see the idea: Let the user input the base and height of a triangle and return the area. Tools: The triangle area formula is (b * h)/2 Most languages have input functions Most languages have output functions Algorithm. Prepare an integer variable base Prepare an integer variable height Prepare a float variable area. Ask the user for the base, store in base Ask the user for the height, store in height Convert input to numeric form if necessary (some languages do this automatically) Calculate area = (base * height) / 2 and store in area output area Once you've broken the problem into simple steps like this it's pretty easy to convert each line of the algorithm into whatever language you want. Try to write an algorithm like this for one of your problems. Look at each line and ask yourself "Can I write this in code?" If you understand exactly what an algorithm means and you're confident you can translate each step into programming code, you have a decent algorithm. (There's much more about algorithm efficiency to learn, but begin with just whether an algorithm can be implemented) Get into the habit of creating algorithms before you write your programs, and you'll be able to handle difficult problems more easily. As to the month length problem, we had February 29th a couple of weeks ago. . . Good luck!

2016-03-29 04:10:01 · answer #2 · answered by ? 4 · 0 0

The total interest amount bharat paid is 5,700. Now using the formula for SI. that is (PNR)/100. We knw that N1=N2=2 , R1=12 and R2=15. let P1 be x1 and P2 be x2. That is,

0.24x1 + 0.30x2 = 5,700.
x1 + x2=20000.

we get x2=15,000 from bank. x1=5000.

ALGRITHM:
1. start
2. read all the values.
3. find total interest
4. find common values and form the equations
5. solve them
6. print the result
7 end

2007-01-01 19:14:53 · answer #3 · answered by avisar 2 · 0 0

Let x be the amount of money he borrowed from the bank. Then 20,000-x is the money he borrowed from his friend.

Balance the total money at the end of 2 years:
(20,000-x)(1.12^2) + x(1.15^2) = 25,700

Solve for x,
x = $8986.78

2007-01-01 19:26:34 · answer #4 · answered by sahsjing 7 · 0 0

(1.24) times X + (1.30) times Y = 25700
X+Y=20000

solve for X (and then Y)

it is 24 and 30 because it is 2 years

2007-01-01 19:03:20 · answer #5 · answered by brainiac 4 · 0 0

impossible

you have to say to whom he paid back 25700.

2007-01-01 21:16:39 · answer #6 · answered by gjmb1960 7 · 0 0

fedest.com, questions and answers