Program to find simple interest Last Updated : 18 Dec, 2024 Comments Improve Suggest changes Like Article Like Report Try it on GfG Practice Given Principal p, Rate r and Time t, the task is to calculate Simple Interest.Examples :Input: p = 10000, r = 5, t = 5 Output:2500 Explanation: We need to find simple interest on Rs. 10,000 at the rate of 5% for 5 units of time. Input: p = 3000, r = 7, t = 1 Output:210The basic idea is to calculate by applying the formula SI = (p x t x r)/100 C++ // CPP program to find simple interest for // given principal amount, time and rate of interest #include<iostream> using namespace std; float simpleInterest(float p, float t, float r){ /* Calculate simple interest */ float ans = (p * t * r) / 100; return ans; } int main() { float p = 1, r = 1, t = 1; cout <<simpleInterest(p,r,t); return 0; } C #include <stdio.h> float simpleInterest(float p, float t, float r) { /* Calculate simple interest */ float ans = (p * t * r) / 100; return ans; } int main() { float p = 1, r = 1, t = 1; printf("%f", simpleInterest(p, r, t)); return 0; } Java class GfG { static float simpleInterest(float p, float t, float r) { /* Calculate simple interest */ return (p * t * r) / 100; } public static void main(String[] args) { float p = 1, r = 1, t = 1; System.out.println(simpleInterest(p, r, t)); } } Python def simpleInterest(p, t, r): /* Calculate simple interest */ return (p * t * r) / 100 if __name__ == "__main__": p = 1 r = 1 t = 1 print(simpleInterest(p, r, t)) C# using System; class GfG { public static float SimpleInterest(float p, float t, float r) { /* Calculate simple interest */ return (p * t * r) / 100; } static void Main() { float p = 1, r = 1, t = 1; Console.WriteLine(SimpleInterest(p, r, t)); } } JavaScript function simpleInterest(p, t, r) { /* Calculate simple interest */ return (p * t * r) / 100; } //driver code let p = 1, r = 1, t = 1; console.log(simpleInterest(p, r, t)); Output0.01Time complexity : O(1) Auxiliary Space : O(1) Comment More infoAdvertise with us Next Article Compound Interest | Set-2 A Anurag Rawat Improve Article Tags : Misc Mathematical DSA Basic Coding Problems Practice Tags : MathematicalMisc Similar Reads Program to find compound interest What is 'Compound interest' ? Compound interest is the addition of interest to the principal sum of a loan or deposit, or in other words, interest on interest. It is the result of reinvesting interest, rather than paying it out, so that interest in the next period is then earned on the principal sum 4 min read Program to print the sum of the given nth term Given the value of the n. You have to find the sum of the series where the nth term of the sequence is given by:Tn = n2 - ( n - 1 )2Examples : Input : 3Output : 9Explanation: So here the term of the sequence upto n = 3 are: 1, 3, 5 And hence the required sum is = 1 + 3 + 5 = 9Input : 6Output : 36Sim 9 min read Compound Interest | Set-2 Compound Interest is one of the most important topics in Quantitative Aptitude and is frequently asked in competitive exams in India. Pre-requisites: Compound Interest - Formula, Definition and ExamplesReal-Life Applications of Compound InterestCompound Interest - Aptitude Questions and AnswersAlso, 5 min read Compound Interest | Set-2 Compound Interest is one of the most important topics in Quantitative Aptitude and is frequently asked in competitive exams in India. Pre-requisites: Compound Interest - Formula, Definition and ExamplesReal-Life Applications of Compound InterestCompound Interest - Aptitude Questions and AnswersAlso, 5 min read Compound Interest | Set-2 Compound Interest is one of the most important topics in Quantitative Aptitude and is frequently asked in competitive exams in India. Pre-requisites: Compound Interest - Formula, Definition and ExamplesReal-Life Applications of Compound InterestCompound Interest - Aptitude Questions and AnswersAlso, 5 min read Program to find the Depreciation of Value The value of any article or item subject to wear and tear, decreases with time. This decrease is called its Depreciation. Given three variable V1, R and T where V1 is the initial value, R is the rate of depreciation and T is the time in years. The task is to find the value of the item after T years. 3 min read Like