Zzuli acm1056 the error of interest from the month _ACM

Source: Internet
Author: User
Tags pow
Bloggers have only heard that Chinese New year interest does not listen to other people using the monthly interest. So a little confused. Sure enough, the time to do the problem is indeed a monk. Let's see if we have the same situation. Error: Package B;
Import Java.util.Scanner;
public class P4 {
public static void Main (string[] args) {double lx,ck; Scanner rd=new Scanner (system.in); Lx=rd.nextdouble (); System.out.println ("" +a (LX));}
Static double A (double x) {double sum=0; for (int i=0;i<=4;i++) {Sum=sum+1000*math.pow (1+x,i*12);
Return Sum/math.pow (1+x,60); This result is: 2690.844729757371 correct: Package B;
Import Java.util.Scanner;
public class P5 {
public static void Main (string[] args) {double x,y=0; Scanner rd=new Scanner (system.in); X=rd.nextdouble (); for (int i=0;i<=4;i++) {Y=y+1000*math.pow (1+x*12,i);
} System.out.printf ("%.2f", Y/math.pow (1+x*12,5));
}
Results: 2833.29. It seems to be reasonable, but the conversion of adult interest seems to have no monthly interest on the profits of high ha ... Blog for the first time. Master Light Spray

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.