diff --git a/src/interestCalculator.c b/src/interestCalculator.c index 8acc998..9329c2a 100644 --- a/src/interestCalculator.c +++ b/src/interestCalculator.c @@ -8,12 +8,21 @@ float timeInYears; printf("Please enter the principal amount:"); scanf("%f",&principalAmount); +if(principalAmount<=0){ + return; +} printf("\nPlease enter interest per year (percentage):"); scanf("%f",&interestPerYear); +if(interestPerYear<=0){ + return; +} printf("\nPlease enter interest time in years:"); scanf("%f",&timeInYears); +if(timeInYears<=0){ + return; +} float interestDecimal=interestPerYear/100;