Question: Suppose bank deposits are divided into five types
Interest rate: 0.63% year (month)
Interest rate: 0.66% two year (month)
Interest rate: 0.69% three years
Interest rate: 0.75% Five year (month)
Interest rate: 0.84% eight year (month)
Now deposit 900000, the deposit period of 20, ask how should choose, can be principal and interest and maximum, how much?
Solution:
Using System;namespace intresting{class Program {static void Main (string[] args) {Savemo Ney (); } static void Savemoney () {int i8, i5, i3, I2, I1, N1, N2, N3, N5, N8; N1 = N2 = N3 = N5 = N8 = 0; Double max = 0; Double term; for (i8 = 0, i8 < 3; i8++) for (i5 = 0; i5 <= (20-8 * i8)/4; i5++) for (i3 = 0 ; i3 <= (20-8 * i8-5 * i5)/3; i3++) for (i2 = 0; i2 <= (20-8 * i8-5 * i5-3 * i3)/2; i2++) { I1 = (20-8 * i8-5 * i5-3 * i3-2 * i2); term = 900000* Math.pow ((1 + 0.0063 *), double. Parse (I1. ToString ())) * Math.pow ((1 + 2*0.0066 *), double. Parse (I2. ToString ())) * Math.pow ((1 + 3*0.0069 *), double. Parse (i3. ToString ())) * MATH.POW ((1 + 5*0.0075 *), double. Parse (i5. ToString ())) * Math.pow ((1 + 8*0.0084 *), double. Parse (i8. ToString ())); if (term > max) {max = Term;n1 = i1; n2 = i2; n3 = i3; N5 = i5; N8 = i8; }} Console.WriteLine ("Best way:"); Console.WriteLine ("One year: {0} times", N1); Console.WriteLine ("Two years: {0} times", N2); Console.WriteLine ("Three years: {0} times", N3); Console.WriteLine ("Five years: {0} times", N5); Console.WriteLine ("Eight years: {0} times", N8); Console.WriteLine ("20 years after the principal and interest and for: {0}", max); Console.WriteLine (); } }}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
C # version of financial experts