Commit 96f14817 by otsall

Replace task.c

parent c106c10f
Showing with 16 additions and 0 deletions
......@@ -95,6 +95,7 @@ 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 (currentbal > 0){
if(i == 1){
for(j = 0; j < years; j++){
currentbal = 1.006 * 1.006 * currentbal;
......@@ -108,5 +109,20 @@ void futurebalance(char array[USERS][DATAVAR][MAXLENGTH], int years, int user){
printf("%d year(s) from now your balance will be %.2f\n", j + 1, balance[j]);
}
}
}else{
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