Porcentaje de aumento en el volumen de la esfera si el radio aumenta en un porcentaje dado

Aquí se da una esfera, cuyo radio se incrementa en un porcentaje dado. La tarea es encontrar el porcentaje de aumento en el volumen de la esfera.
Ejemplos: 
 

Input: x = 10
Output: 33.1%

Input: x = 50
Output: 237.5%

Enfoque
 

  • Sea, el radio de la esfera = a
  • incremento porcentual dado = x%
  • volumen antes del aumento = 4/3*πa^3
  • nuevo radio después del aumento = a + ax/100
  • entonces, nuevo volumen = 4/3*π(a^3 + (ax/100)^3 + 3a^3x/100 + 3a^3x^2/10000)
  • cambio de volumen = 4/3*π((ax/100)^3 + 3a^3x/100 + 3a^3x^2/10000)
  • aumento porcentual en volumen = (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;
}

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..

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

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..

Javascript

<script>
// javascript program to find percentage increase
// in the volume of the sphere
// if radius is increased by a given percentage
function newvol(x)
{
    document.write( "percentage increase in the"
        + " volume of the sphere is "
        +( Math.pow(x, 3) / 10000 + 3 * x
                + (3 * Math.pow(x, 2)) / 100)
        + "%");
}
 
// Driver code
var x = 10;
newvol(x);
 
// This code is contributed by 29AjayKumar
</script>

Producción: 
 

percentage increase in the volume of the sphere is 33.1%

 Complejidad de tiempo: O(1)

Espacio Auxiliar: O(1) ya que usa variables constantes

Publicación traducida automáticamente

Artículo escrito por IshwarGupta y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *