|
@ -27,12 +27,13 @@ if(timeInYears<=0){ |
|
|
float interestDecimal=interestPerYear/100; |
|
|
float interestDecimal=interestPerYear/100; |
|
|
|
|
|
|
|
|
float result= principalAmount*(1+(interestDecimal*timeInYears)); |
|
|
float result= principalAmount*(1+(interestDecimal*timeInYears)); |
|
|
printf("\nAmount with the interest is %f.",result); |
|
|
|
|
|
|
|
|
printf("\nAmount with the interest is %.2f.",result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void initiateCalculator(){ |
|
|
void initiateCalculator(){ |
|
|
|
|
|
|
|
|
int input; |
|
|
int input; |
|
|
|
|
|
char c; |
|
|
printf("Welcome to the interest calculator. Please select an option:\n[1]Calculate yearly interest\n"); |
|
|
printf("Welcome to the interest calculator. Please select an option:\n[1]Calculate yearly interest\n"); |
|
|
scanf("%d", &input); |
|
|
scanf("%d", &input); |
|
|
|
|
|
|
|
@ -43,13 +44,17 @@ void initiateCalculator(){ |
|
|
default: |
|
|
default: |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
printf("\nThank you for using our services. Would you like to do another calculation? [y]Yes [any]No\n"); |
|
|
|
|
|
scanf(" %c", &c); |
|
|
|
|
|
if(c=='y'||c=='Y'){ |
|
|
|
|
|
initiateCalculator(); |
|
|
|
|
|
}else{ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
int main(){ |
|
|
int main(){ |
|
|
|
|
|
|
|
|
initiateCalculator(); |
|
|
initiateCalculator(); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
*/ |
|
|
|