C Language: Deposit interest Calculation, 1000 yuan, deposit 5 years, to seek five kinds of plan deposit five years after the principal and

Source: Internet
Author: User
Tags pow

Calculation of interest on deposits. There are 1000 yuan, 5 years, the following five kinds of options:

(1) 5-year deposit, interest rate R5 = 0.0585

(2) First deposit 2 years, after the expiry of the principal and interest to save 3 years, Interest Rate r2 = 0.0468 , R3 = 0.054

(3) First deposit 3 years, after the expiry of the principal and interest to save 2 years

(4) Deposit 1 years, after expiry the principal and interest Keep saving for 5 consecutive times, Interest Rate r1 = 0.0414

(5) Demand deposit. Current interest is settled quarterly,r0 = 0.0072

Ask five kinds of plan deposit five years after the principal and interest?

Program:

#include <stdio.h>

#include <math.h>

int Main ()

{

float r5,r3,r2,r1,r0,p1,p2,p3,p4,p5,p;

p = 1000;

R0 = 0.0072;

R1 = 0.0414;

r2 = 0.0468;

R3 = 0.054;

R5 = 0.0585;

P1 = p* (1+5*R5);

P2 = p* (1 + 2 * R2) * (1 + 3 * R3);

P3 = p* (1 + 3 * R3) * (1 + 2 * r2);

P4 = P*pow (1+r1,5);

P5 = P*pow (1 + r0/4,4*5);

printf ("p1=%f\n", p1);

printf ("p2=%f\n", p2);

printf ("p3=%f\n", p3);

printf ("p4=%f\n", p4);

printf ("p5=%f\n", p5);

return 0;

}

Results:

p1=1292.500000

p2=1270.763062

p3=1270.763184

p4=1224.863770

p5=1036.621094

Please press any key to continue ...


This article is from the "Rock Owl" blog, please be sure to keep this source http://yaoyaolx.blog.51cto.com/10732111/1739706

C Language: Deposit interest Calculation, 1000 yuan, deposit 5 years, to seek five kinds of plan deposit five years after the principal and

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.