Question
Copy your account.c file from your Lab4 directory into your Lab5 directory. Instead of using the hint given in the text, if you think about
Copy your account.c file from your Lab4 directory into your Lab5 directory. Instead of using the hint given in the text, if you think about this one for a minute, you can do it WITHOUT modifying the function you wrote for Lab4. (Hint: the trick is how you get the values you pass to the function calc_acc_amt(). Think about what the MEANING of the parameters are). However, you should write a new main() function which should repeatedly prompt the user to enter the data as before, and also prompt for either annual, monthly or daily compounding. This should be entered as an integer - 1 for annual, 2 for monthly, and 3 for daily. The program should continue getting data sets until the user enters end of file instead of the initial investment. Use simple macros in this program to avoid any "magic numbers" in your code.
#include
{
int amount, rate, time, si;
printf(" Enter Principal Amount : "); scanf("%d", &amount);
printf(" Enter Rate of Interest : "); scanf("%d", &rate);
printf(" Enter Period of Time : "); scanf("%d", &time);
si = (amount * rate * time) / 100; printf(" Simple Interest : %d ", si);
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started