diff --git a/src/interestCalculator.c b/src/interestCalculator.c index a458947..9964047 100644 --- a/src/interestCalculator.c +++ b/src/interestCalculator.c @@ -126,32 +126,35 @@ void calculateMonthlyInterest(){ printf("\nAmount with the interest is %.2f€.",result); } -void initiateCalculator(){ - +void initiateCalculator() { int input; char c; - printf("Welcome to the interest calculator. Please select an option:\n[1]Calculate yearly interest\n[2]Calculate monthly interest\n"); + + printf("Welcome to the interest calculator. Please select an option:\n" + "[1] Calculate yearly interest\n" + "[2] Calculate monthly interest\n"); scanf("%d", &input); - switch(input){ + switch (input) { case 1: - calculateYearlyInterest(); - break; + calculateYearlyInterest(); + break; case 2: - calculateMonthlyInterest(); - break; + calculateMonthlyInterest(); + break; default: - break; + break; } - printf("\nThank you for using our services. Would you like to do another calculation? [y]Yes [any]No\n"); + + printf("\nThank you for using our services. Would you like to do another calculation? [y/n]: "); scanf(" %c", &c); - if(c=='y'||c=='Y'){ + + if (c == 'y' || c == 'Y') { initiateCalculator(); - }else{ - return; } } + // int main(){ // initiateCalculator();