diff --git a/src/interestCalculator.c b/src/interestCalculator.c new file mode 100644 index 0000000..8acc998 --- /dev/null +++ b/src/interestCalculator.c @@ -0,0 +1,46 @@ +#include "interestCalculator.h" + + +void calculateInterest(){ +float principalAmount; +float interestPerYear; +float timeInYears; + +printf("Please enter the principal amount:"); +scanf("%f",&principalAmount); + +printf("\nPlease enter interest per year (percentage):"); +scanf("%f",&interestPerYear); + +printf("\nPlease enter interest time in years:"); +scanf("%f",&timeInYears); + +float interestDecimal=interestPerYear/100; + +float result= principalAmount*(1+(interestDecimal*timeInYears)); +printf("\nAmount with the interest is %f.",result); +} + +void initiateCalculator(){ + + int input; + printf("Welcome to the interest calculator. Please select an option:\n[1]Calculate yearly interest\n"); + scanf("%d", &input); + + switch(input){ + case 1: + calculateInterest(); + break; + default: + break; + } + +} + +/* +int main(){ + + initiateCalculator(); + +} +*/ \ No newline at end of file diff --git a/src/interestCalculator.h b/src/interestCalculator.h new file mode 100644 index 0000000..bd641cd --- /dev/null +++ b/src/interestCalculator.h @@ -0,0 +1,7 @@ +#ifndef INTERESTCALCULATOR_H_ +#define INTERESTCALCULATOR_H_ + +#include + +void calculateInterest(); +#endif \ No newline at end of file