C003:计算球体体积 自行输入球体半径

程序:

#include "stdafx.h"

int _tmain(int argc, _TCHAR* argv[])
{
    float sphereRadius;
    do{    
        printf("Please input the sphere radius:");
        scanf("%f",&sphereRadius);
        float sphereVolumn=4.0f/3.0f*3.14159*sphereRadius*sphereRadius*sphereRadius;
        printf("Sphere Volumn=%f
",sphereVolumn);
    }while(sphereRadius!=123.0f);
    
    return 0;
}

输出:

Please input the sphere radius:1
Sphere Volumn=4.188787
Please input the sphere radius:2
Sphere Volumn=33.510296
Please input the sphere radius:10
Sphere Volumn=4188.786621
Please input the sphere radius:15
Sphere Volumn=14137.155273

--2020年6月9日--

原文地址:https://www.cnblogs.com/heyang78/p/13073177.html