What is the percentage change in the volume of a cylinder if its height increases by 20% and radius remains the same?

Improve Article

Save Article

Like Article

  • Read
  • Discuss
  • Improve Article

    Save Article

    Given here is a right circular cylinder, whose height increases by a given percentage, but radius remains constant. The task is to find the percentage increase in the volume of the cylinder.
    Examples: 
     

    Input: x = 10 Output: 10% Input: x = 18.5 Output: 18.5%

    Approach
     

    • Let, the radius of the cylinder = r
    • height of the cylinder = h
    • given percentage increase = x%
    • so, old volume = π*r^2*h
    • new height = h + hx/100
    • new volume = π*r^2*(h + hx/100)
    • so, increase in volume = πr^2*(hx/100)
    • so percentage increase in volume = (πr^2*(hx/100))/(πr^2*(hx/100))*100 = x

    #include <bits/stdc++.h>

    using namespace std;

    void newvol(double x)

    {

        cout << "percentage increase "

             << "in the volume of the cylinder is "

             << x << "%" << endl;

    }

    int main()

    {

        double x = 10;

        newvol(x);

        return 0;

    }

    import java.io.*;

    class GFG

    {

    static void newvol(double x)

    {

        System.out.print( "percentage increase "

            + "in the volume of the cylinder is "

            + x + "%" );

    }

    public static void main (String[] args)

    {

        double x = 10;

        newvol(x);

    }

    }

    def newvol(x):

        print("percentage increase in the volume of the cylinder is ",x,"%")

    x = 10.0

    newvol(x)

    using System;

    class GFG

    {

    static void newvol(double x)

    {

        Console.WriteLine( "percentage increase "

            + "in the volume of the cylinder is "

            + x + "%" );

    }

    public static void Main ()

    {

        double x = 10;

        newvol(x);

    }

    }

    <script>

    function newvol(x)

    {

        document.write( "percentage increase "

            + "in the volume of the cylinder is "

            + x + "%" );

    }

    var x = 10;

    newvol(x);

    </script>

    Output: 
     

    percentage increase in the volume of the cylinder is 10.0%

    Time Complexity: O(1), since there is no loop.

    Auxiliary Space: O(1), since no extra space has been taken.