#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