Geliştirebileceğiniz bir finans hesap makinesi kodunu burada veriyorum aynı zamanda kod ektedir.
/* a simple finance calculator with C */
/* C ile basit bir finans hesap makinesi */
#include<stdio.h>
int main()
{
double initial_balance;
double yearly_interest;
double withdrawn_money;
double interest;
printf("welcome to financial calculator\n");
printf("what's your initial balance?==>\n");
scanf("%lf",&initial_balance);
printf("what's the yearly interest?==>\n");
scanf("%lf",&yearly_interest);
printf("how much do you plan withdraw monthly? ==>\n");
scanf("%lf",&withdrawn_money);
interest = initial_balance * (yearly_interest / 12) / 100 ;
if(interest < withdrawn_money){
int counter = 0;
int year;
while (initial_balance > withdrawn_money){
interest = initial_balance * ((yearly_interest / 12) / 100);
initial_balance += interest;
initial_balance -= withdrawn_money;
counter++;
}
year = counter / 12;
printf("the account will last %d year (s) and %d month (s)\n", year, counter - year * 12);
printf("ending balance will be ==> %.1f dollars.\n",initial_balance);
}
else {
int month_number;
int i;
printf("this will last forever\n");
printf("enter a month number\n");
scanf("%d",&month_number);
for(i = 1; i <=month_number; i++){
initial_balance += (initial_balance * (yearly_interest / 12) * 1 ) / 100;
initial_balance -= withdrawn_money;
}
printf("your balance will be %.3f $ after %d months \n",initial_balance,month_number);
}
return 0;
}
finans_makinesi.C (1,42 kb)