📌  相关文章
📜  如果高度增加给定的百分比但半径保持不变,则圆柱体的百分比增加

📅  最后修改于: 2021-10-23 08:09:38             🧑  作者: Mango

这里给出的是一个正圆柱体,其高度增加了给定的百分比,但半径保持不变。任务是找出圆柱体体积增加的百分比。
例子:

Input: x = 10
Output: 10%

Input: x = 18.5
Output: 18.5%

方法

  • 让,圆柱的半径 = r
  • 圆柱体高度 = h
  • 给定百分比增加 = x%
  • 所以,旧体积 = π*r^2*h
  • 新高度 = h + hx/100
  • 新体积 = π*r^2*(h + hx/100)
  • 所以,体积增加 = πr^2*(hx/100)
  • 所以体积增加百分比 = (πr^2*(hx/100))/(πr^2*(hx/100))*100 = x

C++
// C++ program to find percentage increase
// in the cylinder if the height
// is increased by given percentage
// but radius remains constant
 
#include 
using namespace std;
 
void newvol(double x)
{
    cout << "percentage increase "
         << "in the volume of the cylinder is "
         << x << "%" << endl;
}
 
// Driver code
int main()
{
    double x = 10;
    newvol(x);
    return 0;
}


Java
// Java program to find percentage increase
// in the cylinder if the height
// is increased by given percentage
// but radius remains constant
import java.io.*;
 
class GFG
{
 
static void newvol(double x)
{
    System.out.print( "percentage increase "
        + "in the volume of the cylinder is "
        + x + "%" );
}
 
// 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 cylinder if the height
# is increased by given percentage
# but radius remains constant
 
def newvol(x):
    print("percentage increase in the volume of the cylinder is ",x,"%")
 
# Driver code
x = 10.0
newvol(x)
 
# This code is contributed by mohit kumar 29


C#
// C# program to find percentage increase
// in the cylinder if the height
// is increased by given percentage
// but radius remains constant
using System;
 
class GFG
{
 
static void newvol(double x)
{
    Console.WriteLine( "percentage increase "
        + "in the volume of the cylinder is "
        + x + "%" );
}
 
// Driver code
public static void Main ()
{
    double x = 10;
    newvol(x);
}
}
 
// This code is contributed by anuj_67..


Javascript


输出:

percentage increase in the volume of the cylinder is 10.0%

如果您希望与专家一起参加现场课程,请参阅DSA 现场工作专业课程学生竞争性编程现场课程