欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

计算圆柱体积

程序员文章站 2022-07-07 11:26:38
...
#include<stdio.h>
double cylinder(double r, double h)
{
	double result;
	result=3.1415926*r*r*h;
	printf("Volume=%.3f\n",result);
    return result; 
} 
int main()
{
	double height, radius, volume;
	printf("Enter radius and height:");
	scanf("%lf %lf",&radius,&height);
	cylinder(radius,height);
	return 0; 
}
#include<stdio.h>
double cylinder(double r, double h); 
int main()
{
	double height, radius, volume;
	printf("Enter radius and height:");
	scanf("%lf %lf",&radius,&height);
	volume=cylinder(radius,height);
	printf("Volume=%.3f\n",volume);
	return 0; 
}
double cylinder(double r, double h)
{
	double result;
	result=3.1415926*r*r*h;
    return result; 
} 

相关标签: c语言 c#