Code For Alls..!

get the code!!

Tuesday, 1 August 2017

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

C code:
#include<stdio.h>
#include <stdlib.h>
int main()
{
int p;
float n;
scanf("%f\n%d",&n,&p);
printf("%.2f",(float)((n*100)/(100+p)));
}

No comments:

Post a Comment