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\n",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日--

posted @ 2020-06-09 15:58  逆火狂飙  阅读(304)  评论(0编辑  收藏  举报
生当作人杰 死亦为鬼雄 至今思项羽 不肯过江东