设圆半径r=1.5,圆柱高h=3,求圆周长、圆面积、圆球表面积、圆球体积和圆柱体积.用scanf函数输入数据,

1个回答

  • #include

    #include

    #define PI 3.1415

    void main()

    {

    x09float r = 1.5,h = 3;

    x09float circ = 2*PI*r;

    x09float area = PI*r*r;

    x09float surface_area = 4*PI*r*r;

    x09float volume1 = 3*PI*r*r*r/4;

    x09float volume2 = PI*r*r*h

    x09printf("圆的周长为:%.2fn",circ);

    x09printf("圆的面积为:%.2fn",area);

    x09printf("圆球的表面积为:%.2fn",surface_area);

    x09printf("圆球的体积为:%.2fn",volume);

    x09printf("圆柱的体积为:%.2fn",volume2);

    x09syatem("pause");

    }