Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- 5. Simply Interested
- You’ve taken the leap and finally decided to buy a car. Congratulations! The bad news is that you’ll have to pay a monthly fee for that car for the next few years.
- In order to make sure you’d have enough money to pay for the car and all your other expenses, it would be best if you calculate the simple interest of your purchase ahead of time. This can be done using this equation: Simple Interest = (amount * rate * time) / 100.
- Make sure to round off to the nearest hundredths!
- Inputs
- 1. The amount
- The amount can be a decimal number.
- 2. The rate percentage
- The rate percentage can be a decimal number.
- 3. The number of years
- */
- #include <stdio.h>
- int main(){
- int years;
- float rate,amount,interest,s1;
- printf("Enter the amount: ");
- scanf("%f",&amount);
- printf("Enter the rate percentage: ");
- scanf("%f",&rate);
- printf("Enter the number of year: ");
- scanf("%d",&years);
- s1 = ( amount * rate ) * years;
- interest = s1 / 100;
- printf("Simple interest = %.2f",interest);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement