Related Articles
Percentage change in Hemisphere volume if radius is changed
• Difficulty Level : Medium
• Last Updated : 24 Jan, 2020

Given that the radius of a hemisphere is changed by a fixed percentage so, the target is to calculate the percentage changed in the volume of the hemisphere.

Examples:
Input: r = 20%
Output: 72.80%

Input: r = 70%
Output: 391.30 %

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

Approach:

• Let, the radius of the hemisphere = • Given percentage increase = • Volume before increase = • New radius after increase = • So, new volume = • Change in volume = • Percentage increase in volume  Below is the implementation of the above approach:

## CPP

 // C++ program to find percentage change// in hemisphere volume wrt change in radius  #include #include using namespace std;  // Function to find the change// in hemispheric volumevoid new_vol(double x){      if (x > 0) {          cout << "% change in the "             << "volume of the hemisphere: "             << pow(x, 3) / 10000 + 3 * x                    + (3 * pow(x, 2)) / 100             << "%"             << " increase\n";    }      else if (x < 0) {          cout << "% change in the "             << "volume of the hemisphere: "             << pow(x, 3) / 10000 + 3 * x                    + (3 * pow(x, 2)) / 100             << "% decrease\n";    }      else {        cout << "Volume remains the same.";    }}  // Driver codeint main(){      // Get the change in radius    double x = -10.0;      // Calculate the change in hemispheric volume    new_vol(x);      return 0;}

## Java

 // Java program to find percentage change// in hemisphere volume wrt change in radiusclass GFG{  // Function to find the change// in hemispheric volumestatic void new_vol(double x){      if (x > 0)    {          System.out.print("% change in the "            + "volume of the hemisphere: "            + (Math.pow(x, 3) / 10000 + 3 * x                    + (3 * Math.pow(x, 2)) / 100)            + "%"            + " increase\n");    }      else if (x < 0)     {          System.out.print("% change in the "            + "volume of the hemisphere: "            + (Math.pow(x, 3) / 10000 + 3 * x                    + (3 * Math.pow(x, 2)) / 100)            + "% decrease\n");    }      else     {        System.out.print("Volume remains the same.");    }}  // Driver codepublic static void main(String[] args){      // Get the change in radius    double x = -10.0;      // Calculate the change in hemispheric volume    new_vol(x);}}  // This code is contributed by Rajput-Ji

## Python

 # Python3 program to find percentage change# in hemisphere volume wrt change in radius    # Function to find the change# in hemispheric volumedef new_vol(x):      if (x > 0):          print("% change in the volume of the hemisphere: ", pow(x, 3) / 10000 + 3 * x + (3 * pow(x, 2)) / 100,"% increase")      elif (x < 0):          print("% change in the volume of the hemisphere: ", pow(x, 3) / 10000 + 3 * x + (3 * pow(x, 2)) / 100,"% decrease")      else:        print("Volume remains the same.")# Driver code  # Get the change in radiusx = -10.0  # Calculate the change in hemispheric volumenew_vol(x)  # This code is contributed by mohit kumar 29

## C#

 // C# program to find percentage change// in hemisphere volume wrt change in radiususing System;  class GFG{      // Function to find the change    // in hemispheric volume    static void new_vol(double x)    {        if (x > 0)        {                  Console.Write("% change in the "                + "volume of the hemisphere: "                + (Math.Pow(x, 3) / 10000 + 3 * x                        + (3 * Math.Pow(x, 2)) / 100)                + "%"                + " increase\n");        }              else if (x < 0)         {                  Console.Write("% change in the "                + "volume of the hemisphere: "                + (Math.Pow(x, 3) / 10000 + 3 * x                        + (3 * Math.Pow(x, 2)) / 100)                + "% decrease\n");        }              else        {            Console.Write("Volume remains the same.");        }    }          // Driver code    public static void Main()    {              // Get the change in radius        double x = -10.0;              // Calculate the change in hemispheric volume        new_vol(x);    }}  // This code is contributed by AnkitRai01
Output:
% change in the volume of the hemisphere: -27.1% decrease


Attention reader! Don’t stop learning now. Get hold of all the important mathematical concepts for competitive programming with the Essential Maths for CP Course at a student-friendly price. To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.

My Personal Notes arrow_drop_up