# Program to calculate GST from original and net prices

Given Original cost and Net price then calculate the percentage of GST

Examples:

```Input : Netprice = 120, original_cost = 100
Output : GST = 20%

Input : Netprice = 105, original_cost = 100
Output : GST = 5%
```

## Recommended: Please try your approach on {IDE} first, before moving on to the solution.

How to calculate GST
GST ( Goods and Services Tax ) which is included in netprice of product for get GST % first need to calculate GST Amount by subtract original cost from Netprice and then apply
GST % formula = (GST_Amount*100) / original_cost

Netprice = original_cost + GST_Amount
GST_Amount = Netprice – original_cost
GST_Percentage = (GST_Amount * 100)/ original_cost

## C++

 `// CPP Program to compute GST from original ` `// and net prices. ` `#include ` `using` `namespace` `std; ` ` `  `float` `Calculate_GST(``float` `org_cost, ``float` `N_price) ` `{ ` `    ``// return value after calculate GST% ` `    ``return` `(((N_price - org_cost) * 100) / org_cost); ` `} ` `// Driver program to test above functions ` `int` `main() ` `{ ` `    ``float` `org_cost = 100; ` `    ``float` `N_price = 120; ` `    ``cout << ``"GST = "` `         ``<< Calculate_GST(org_cost, N_price) ` `         ``<< ``" % "``; ` `    ``return` `0; ` `} `

## Java

 `// Java Program to compute GST  ` `// from original and net prices. ` `import` `java.io.*; ` ` `  `class` `GFG  ` `{ ` `    ``static` `float` `Calculate_GST(``float` `org_cost,  ` `                                  ``float` `N_price) ` `    ``{ ` `        ``// return value after calculate GST% ` `        ``return` `(((N_price - org_cost) * ``100``)  ` `                 ``/ org_cost); ` `    ``} ` `     `  `    ``// Driver code ` `    ``public` `static` `void` `main (String[] args)  ` `    ``{ ` `         ``float` `org_cost = ``100``; ` `        ``float` `N_price = ``120``; ` `        ``System.out.print(``" GST = "`  `+ Calculate_GST ` `                         ``(org_cost, N_price) + ``"%"``); ` `    ``} ` `} ` ` `  `// This code is contributed  ` `// by vt_m. `

## Python3

 `# Python3 Program to ` `# compute GST from original ` `# and net prices. ` ` `  `def` `Calculate_GST(org_cost, N_price): ` ` `  `    ``# return value after calculate GST% ` `    ``return` `(((N_price ``-` `org_cost) ``*` `100``) ``/` `org_cost); ` ` `  `# Driver program to test above functions ` `org_cost ``=` `100` `N_price ``=` `120` `print``(``"GST = "``,end``=``'') ` ` `  `print``(``round``(Calculate_GST(org_cost, N_price)),end``=``'') ` ` `  `print``(``"%"``) ` ` `  `# This code is contributed ` `# by Smitha Dinesh Semwal `

## C#

 `// C# Program to compute GST  ` `// from original and net prices. ` `using` `System; ` ` `  `class` `GFG  ` `{ ` `    ``static` `float` `Calculate_GST(``float` `org_cost,  ` `                                ``float` `N_price) ` `    ``{ ` `        ``// return value after calculate GST% ` `        ``return` `(((N_price - org_cost) * 100)  ` `                ``/ org_cost); ` `    ``} ` `     `  `    ``// Driver code ` `    ``public` `static` `void` `Main ()  ` `    ``{ ` `        ``float` `org_cost = 100; ` `        ``float` `N_price = 120; ` `        ``Console.Write(``" GST = "` `+ Calculate_GST ` `                        ``(org_cost, N_price) + ``"%"``); ` `    ``} ` `} ` ` `  `// This code is contributed  ` `// by vt_m. `

## PHP

 ` `

Output:

```GST = 20%
```

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Improved By : vt_m

Article Tags :
Practice Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.