编程学习网为您整理以下代码实例,主要实现:取浮点数并进行多次计算,希望可以帮到各位朋友。
#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;
}
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!