- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- 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 calculate GST from original and net prices

Given with the original cost and net price as an input and the task is to calculate the GST percentage and display the result

GST stands for Goods and Service task. It is always included in the Net price of the product and before calculating the GST percentage we need to calculate GST amount and for that there are formulas available

Netprice = originalcost + GSTAmount

GSTAmount = Netprice – original_cost

GST_Percentage = (GSTAmount * 100)/ originalcost

GST % formula = (GSTAmount*100) / originalcost

## Example

Input-: cost = 120.00 price = 150.00 Output-: GST amount is = 25.00 % Input-: price = 120.00 cost = 100.00 Output-: GST amount is = 20.00 %

**Approach used in the given program is as follows** −

- Take the input as net price and original cost
- Apply the formula given to calculate GST percentage
- Display the result

## Algorithm

Start Step 1-> declare function to calculate GST float GST(float cost, float price) return (((price - cost) * 100) / cost) step 2-> In main() set float cost = 120 set float price = 150 call GST(cost, price) Stop

## Example

Using c++ #include <iostream> using namespace std; //function to calculate GST float GST(float cost, float price) { return (((price - cost) * 100) / cost); } int main() { float cost = 120.00; float price = 150.00; cout << "GST amount is = "<<GST(cost, price)<<" % "; return 0; }

## Output

IF WE RUN THE ABOVE CODE IT WILL GENERATE FOLLOWING OUTPUT

GST amount is = 25.00 %

## Using C

## Example

#include <stdio.h> //function to calculate GST float GST(float cost, float price) { return (((price - cost) * 100) / cost); } int main() { float cost = 120; float price = 150; float gst = GST(cost, price); printf("GST amount is : %.2f ",gst); return 0; }

## Output

IF WE RUN THE ABOVE CODE IT WILL GENERATE FOLLOWING OUTPUT

GST amount is : 25.00

- Related Questions & Answers
- How to Calculate Net Asset Turnover?
- How to calculate net present value using Net present value (NPV)?
- Upgrading SAP .NET Connector from .NET 2.0 to .NET 3.0
- Distinguish between GST and SST
- How do you calculate Net Current Assets Turnover?
- Write the differences between VAT and GST
- How to calculate the Net Present Value (NPV) of an investment?
- Calculate average of ratings in array and then include the field to original document in MongoDB?
- Things to know about GST as it rolls out from July 1
- Python Program to calculate function from indicator random variable from given condition
- Program to calculate area and perimeter of Trapezium
- Reconstruct Original Digits from English in C++
- Program to calculate area and perimeter of equilateral triangle
- Program to calculate area and volume of a Tetrahedron
- Java Program to calculate Simple Interest and Compound Interest

Advertisements