 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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%
Advertisements
 