VOOZH about

URL: https://www.geeksforgeeks.org/r-language/r-program-to-calculate-simple-interest/

⇱ R Program to Calculate Simple Interest - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

R Program to Calculate Simple Interest

Last Updated : 23 Jul, 2025

Basically, Simple Interest is a quick method to calculate the interest charge of a loan. It is determined by multiplying the principal amount by the daily interest rate by the number of days which elapse between the payments. It gets estimated day to day-with the help of mathematical terms.

we will create a program to calculate simple interest in R Programming Language.

Formula:

Simple Interest = (P x R x T)/100

The Algorithm is:

  1. First, we need to define the Principle, Rate, and Interest
  2. Then, need to Apply the formula
  3. Finally, we can print the Simple Interest.

Here we create an R program to calculate Simple Interest:

Output:

Simple Interest: 6000

In the mentioned program, define a function like 'calculate_simple_interest' which takes three arguments called 'principal', 'rate', and 'time'. Then the function used the Formula for Calculating the Simple Interest.

Example 2: Here's another approach to calculating simple interest in R using a more concise method

Output:

Principal amount: $ 1000 
Rate of interest: 5 %
Time: 2 years
Simple Interest: $ 100
Comment
Article Tags:
Article Tags:

Explore