Single compound interest calculation enhanced version

Source: Internet
Author: User

#include <stdio.h>
#include <math.h>

void Fuli () {
int n,i;
Double LL,SUM,BJ;
System ("CLS");
printf ("\t\t\t Welcome to Single compound calculation: \ n");
printf ("Please enter the Principal:");
scanf ("%lf", &BJ);
printf ("Enter the year to store:");
scanf ("%d", &n);
printf ("Input interest rate:");
scanf ("%lf", &ll);
printf ("Input Compounding Number:");
scanf ("%d", &i);
printf ("outputting:");
Ll=pow ((1+ll/i), i)-1;
sum=bj* (POW (1+ll,n));
printf ("Earned%lf", sum);
printf ("\ n");
}

void Danli () {
int n;
Double LL,SUM,BJ;
System ("CLS");
printf ("\t\t\t Welcome to Single compound calculation: \ n");
printf ("Please enter the Principal:");
scanf ("%lf", &BJ);
printf ("Please enter storage year:");
scanf ("%d", &n);
printf ("Input interest rate:");
scanf ("%lf", &ll);
printf ("outputting:");
Sum=bj+bj*n*ll;
printf ("Earned%lf", sum);
printf ("\ n");
}

void Benjin () {
int n,i;
Double LL,SUM,BJ;
System ("CLS");
printf ("\t\t\t Welcome to Single compound calculation: \ n");
printf ("Please enter the total value you need:");
scanf ("%lf", &sum);
printf ("Please enter the storage year you need:");
scanf ("%d", &n);
printf ("Please enter interest rate:");
scanf ("%lf", &ll);
printf ("Please enter the number of compounding times:");
scanf ("%d", &i);
Ll=pow ((1+ll/i), i)-1;
Bj=sum/pow (1+ll,n);
printf ("outputting:");
printf ("Required principal%lf", BJ);
printf ("\ n");
}


Main () {
int A;
printf ("\t\t\t Welcome to Single compound calculation: \ n");
printf ("\t1. Simple interest Calculation");
printf ("\n\t2. Compound interest Calculation");
printf ("\n\t3. Seek principal");
printf ("\ n Please enter your options:");
scanf ("%d", &a);
Switch (a) {
Case 1:
Danli ();
Break
Case 2:
Fuli ();
Break
Case 3:
Benjin ();
Break
Default
return 0;
}
}

Single compound interest calculation enhanced version

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.