An authority requires a deposit on a car loan according to the following schedul
ID: 3585165 • Letter: A
Question
An authority requires a deposit on a car loan according to the following schedule:
Loan$ Deposit
Less than $10000 10% of loan value
Less than $15000 $200 + 6% of loan value
Less than $20000 $500+ 5% of loan value
Less than $50000 $1000 + 3% of loan value
Loans in excess of $50000 are not allowed. Write a C not C++ program that will read a loan amount and compute and print the required deposit to the nearst cent. For Example: A Loan amount of $49999 is calculated by (49999x.03) + 1000 = $2499.97
Explanation / Answer
#include <stdio.h>
#include <ctype.h>
int main()
{
double loanAmount;
int fee = 0;
int percentage;
double deposit;
printf("Enter the loan amount: ");
scanf("%lf", &loanAmount);
if(loanAmount < 50000) {
if(loanAmount < 10000) {
percentage= 10;
fee = 0;
} else if(loanAmount >=10000 && loanAmount < 15000) {
percentage = 6;
fee = 200;
} else if(loanAmount >=15000 && loanAmount < 20000) {
percentage = 5;
fee = 500;
} else if(loanAmount >=20000 && loanAmount < 50000) {
percentage = 3;
fee = 1000;
}
deposit = (loanAmount * percentage)/100 + fee;
printf("Deposit Amount is $%.2lf ", deposit);
}
else {
printf("Loans in excess of $50000 are not allowed ");
}
return 0;
}
Output:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.