Percentage increase in volume of the sphere if radius is increased by a given percentage

Given here is a sphere, whose radius is increased by a given percentage. The task is to find the percentage increase in the volume of the sphere.

**Examples:**

Input:x = 10Output:33.1%Input:x = 50Output:237.5%

**Approach**:

- Let, the radius of the sphere =
**a** - given percentage increase =
**x%** - volume before increase =
**4/3*πa^3** - new radius after increase =
**a + ax/100** - so,
**new volume = 4/3*π(a^3 + (ax/100)^3 + 3a^3x/100 + 3a^3x^2/10000)** - change in volume =
**4/3*π((ax/100)^3 + 3a^3x/100 + 3a^3x^2/10000)** - percentage increase in volume =
**(4/3*π*((ax/100)^3 + 3a^3x/100 + 3a^3x^2/10000)/4/3*π*a^3) * 100 = x^3/10000 + 3x + 3x^2/100**

## C++

`// C++ program to find percentage increase ` `// in the volume of the sphere ` `// if radius is increased by a given percentage ` ` ` `#include <bits/stdc++.h> ` `using` `namespace` `std; ` ` ` `void` `newvol(` `double` `x) ` `{ ` ` ` `cout << ` `"percentage increase in the"` ` ` `<< ` `" volume of the sphere is "` ` ` `<< ` `pow` `(x, 3) / 10000 + 3 * x ` ` ` `+ (3 * ` `pow` `(x, 2)) / 100 ` ` ` `<< ` `"%"` `<< endl; ` `} ` ` ` `// Driver code ` `int` `main() ` `{ ` ` ` `double` `x = 10; ` ` ` `newvol(x); ` ` ` `return` `0; ` `} ` |

*chevron_right*

*filter_none*

## Java

`// Java program to find percentage increase ` `// in the volume of the sphere ` `// if radius is increased by a given percentage ` `import` `java.io.*; ` ` ` `class` `GFG ` `{ ` ` ` `static` `void` `newvol(` `double` `x) ` `{ ` ` ` `System.out.print( ` `"percentage increase in the"` ` ` `+ ` `" volume of the sphere is "` ` ` `+( Math.pow(x, ` `3` `) / ` `10000` `+ ` `3` `* x ` ` ` `+ (` `3` `* Math.pow(x, ` `2` `)) / ` `100` `) ` ` ` `+ ` `"%"` `); ` `} ` ` ` `// Driver code ` `public` `static` `void` `main (String[] args) ` `{ ` ` ` `double` `x = ` `10` `; ` ` ` `newvol(x); ` `} ` `} ` ` ` `// This code is contributed by anuj_67.. ` |

*chevron_right*

*filter_none*

## Python3

`# Python3 program to find percentage increase ` `# in the volume of the sphere ` `# if radius is increased by a given percentage ` ` ` `def` `newvol(x): ` ` ` ` ` `print` `(` `"percentage increase in the"` ` ` `" volume of the sphere is "` ` ` `,` `pow` `(x, ` `3` `) ` `/` `10000` `+` `3` `*` `x ` ` ` `+` `(` `3` `*` `pow` `(x, ` `2` `)) ` `/` `100` ` ` `,` `"%"` `) ` ` ` `# Driver code ` `x ` `=` `10.0` `newvol(x) ` ` ` `# This code is contributed mohit kumar 29 ` |

*chevron_right*

*filter_none*

## C#

`// C# program to find percentage increase ` `// in the volume of the sphere ` `// if radius is increased by a given percentage ` `using` `System; ` ` ` `class` `GFG ` `{ ` ` ` `static` `void` `newvol(` `double` `x) ` `{ ` ` ` `Console.WriteLine( ` `"percentage increase in the"` ` ` `+ ` `" volume of the sphere is "` ` ` `+( Math.Pow(x, 3) / 10000 + 3 * x ` ` ` `+ (3 * Math.Pow(x, 2)) / 100) ` ` ` `+ ` `"%"` `); ` `} ` ` ` `// Driver code ` `public` `static` `void` `Main () ` `{ ` ` ` `double` `x = 10; ` ` ` `newvol(x); ` `} ` `} ` ` ` `// This code is contributed by anuj_67.. ` |

*chevron_right*

*filter_none*

**Output:**

percentage increase in the volume of the sphere is 33.1%

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.