Commit 96f14817 by otsall

Replace task.c

parent c106c10f
Showing with 25 additions and 9 deletions
......@@ -95,17 +95,33 @@ void futurebalance(char array[USERS][DATAVAR][MAXLENGTH], int years, int user){
}
printf("your balance right now is %s\n", array[user][3]);
currentbal = atof(array[user][3]);
if(i == 1){
for(j = 0; j < years; j++){
currentbal = 1.006 * 1.006 * currentbal;
balance[j] = currentbal;
printf("%d year(s) from now your balance will be %.2f\n", j + 1, balance[j]);
if (currentbal > 0){
if(i == 1){
for(j = 0; j < years; j++){
currentbal = 1.006 * 1.006 * currentbal;
balance[j] = currentbal;
printf("%d year(s) from now your balance will be %.2f\n", j + 1, balance[j]);
}
}else{
for(j = 0; j < years; j++){
currentbal = 1.005 * currentbal;
balance[j] = currentbal;
printf("%d year(s) from now your balance will be %.2f\n", j + 1, balance[j]);
}
}
}else{
for(j = 0; j < years; j++){
currentbal = 1.005 * currentbal;
balance[j] = currentbal;
printf("%d year(s) from now your balance will be %.2f\n", j + 1, balance[j]);
if(i == 1){
for(j = 0; j < years; j++){
currentbal = -1.079 * abs(currentbal);
balance[j] = currentbal;
printf("%d year(s) from now your balance will be %.2f\n", j + 1, balance[j]);
}
}else{
for(j = 0; j < years; j++){
currentbal = -1.083 * abs(currentbal);
balance[j] = currentbal;
printf("%d year(s) from now your balance will be %.2f\n", j + 1, balance[j]);
}
}
}
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment