Answers for "c++ program for inflation rate of two numbers"

C++
0

c++ program for inflation rate of two numbers

#include <iostream>
using namespace std;
double InflationRate(float x, float z);
int main()
{  
    float x, z;
    cout << "Enter the old indicies:";
    cin >> x;
    cout << "Enter the new indicies:";
    cin>> z;
    double Rate = InflationRate(x, z);
    cout << "Inflation rate is: " << Rate << endl;
    return 0;
}
double InflationRate (float x, float z)
{
   if(x<0||z<0||x==0)
   return 0;
   return (z - x) / x * 100;

}
Posted by: Guest on January-24-2022

Code answers related to "c++ program for inflation rate of two numbers"

Browse Popular Code Answers by Language