Advertisement
Sierra_ONE

Simply Interested

Oct 8th, 2023
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.05 KB | Source Code | 0 0
  1. /*
  2. 5. Simply Interested
  3. 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.
  4.  
  5. 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.
  6.  
  7. Make sure to round off to the nearest hundredths!
  8.  
  9. Inputs
  10. 1. The amount
  11. The amount can be a decimal number.
  12.  
  13. 2. The rate percentage
  14. The rate percentage can be a decimal number.
  15.  
  16. 3. The number of years
  17. */
  18.  
  19. #include <stdio.h>
  20.  
  21. int main(){
  22.    
  23.     int years;
  24.     float rate,amount,interest,s1;
  25.    
  26.     printf("Enter the amount: ");
  27.     scanf("%f",&amount);
  28.     printf("Enter the rate percentage: ");
  29.     scanf("%f",&rate);
  30.     printf("Enter the number of year: ");
  31.     scanf("%d",&years);
  32.    
  33.     s1 = ( amount * rate ) * years;
  34.     interest = s1 / 100;
  35.  
  36.     printf("Simple interest = %.2f",interest);
  37.  
  38.  
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement