Price Before GST

                      Price Before GST

 


The amount payable after GST - AP is applied is passed as the input. The GST rate R as percentage is also passed as the input.
The program must print the price P on which the GST was applied, with the precision upto 2 decimal places.
Input Format:
The first line contains AP.
The second line contains R.
Output Format:
The first line contains P.
Boundary Conditions:
1.00 <= AP <= 99999.99
2 <= R <= 40
Example Input/Output 1:
Input:
118
18
Output:
100.00
Example Input/Output 2:
Input:
133.10
10
Output:
121.00

Code:

#include<iostream>
#include<iomanip>
using namespace std;
int main(int argc, char** argv)
{
    float a,r;
    cin>>a>>r;
    cout<<fixed<<setprecision(2)<<(float)(a*100)/(100+r);
}

Add a Comment

Your email address will not be published. Required fields are marked *