- C++ Basics
- C++ Home
- C++ Overview
- C++ Environment Setup
- C++ Basic Syntax
- C++ Comments
- C++ Data Types
- C++ Variable Types
- C++ Variable Scope
- C++ Constants/Literals
- C++ Modifier Types
- C++ Storage Classes
- C++ Operators
- C++ Loop Types
- C++ Decision Making
- C++ Functions
- C++ Numbers
- C++ Arrays
- C++ Strings
- C++ Pointers
- C++ References
- C++ Date & Time
- C++ Basic Input/Output
- C++ Data Structures

- C++ Object Oriented
- C++ Classes & Objects
- C++ Inheritance
- C++ Overloading
- C++ Polymorphism
- C++ Abstraction
- C++ Encapsulation
- C++ Interfaces

# C++ program to find the rate percentage from compound interest of consecutive years

In this tutorial, we will be discussing a program to find the rate percentage from compound interest of the consecutive years.

For this, we will be provided with two integers say A and B that are the interests of two consecutive years. Our task is to find the rate of interest for the given values.

Finding the relation between the given values and eliminating the principal amount, we get the formula as

**rate = ((B-A)*100)/A**

## Example

#include <bits/stdc++.h> using namespace std; //calculating the rate of interest float calc_rate(int N1, int N2) { float rate = (N2 - N1) * 100 / float(N1); return rate; } int main() { int N1 = 15, N2 = 18; cout << calc_rate(N1, N2) << "%" << endl; return 0; }

## Output

20%

- Related Articles
- Find the compound interest at the rate of 5 % per annum for 3 years on that principal which in 3 years at the rate of 5 % per annum gives Rs 1200 as simple interest.
- Calculate the compound interest on Rs. 80,000 for 3 years if the rate of interest for the 3 successive years are 4%, 5% and 10% respectively.
- What are the differences between interest rate and annual percentage rate?
- Program to find compound interest in C++
- Java Program to Calculate the Compound Interest
- Java Program to calculate Simple Interest and Compound Interest
- Swift Program to Calculate simple interest and compound interest
- Haskell Program to Calculate simple interest and compound interest
- Kotlin Program to calculate Simple Interest and Compound Interest
- C++ Program to Calculate simple interest and compound interest
- Java Program to calculate Compound Interest
- Swift Program to Calculate Compound Interest
- Kotlin Program to Calculate Compound Interest
- C Program for the compound interest?
- In how many full years will the sum of money become more than double at the compound interest rate of 20% per annum?

Advertisements