取浮点数并进行多次计算

#include <stdio.h>

int main (){
    float d = 6.5;
    float half, square, cube;

    half = d / 2;
    square = d * d;
    cube = d * d * d;

    printf(\nYour number is %.2f\n, d);
    printf(Half of it is %.2f\n, half);
    printf(Square it to get %.2f\n, square);
    printf(Cube it to get %.2f\n, cube);

    return 0;
}

相关文章

for遍历数组
。。。
声明一个计数循环
咕咕咕
#include <stdio.h> int main (void) { printf (&quo...