C语言—浮点数

作者:追风剑情 发布于:2019-7-15 21:06 分类:C

示例

#include <stdio.h>
int main(void)
{
	int i = 1;
	float f = 2;
	float f1 = 2.13145;
	float f2 = 3.16E7;//3.16乘10的7次方
	float f3 = 7.00;
	float f4 = 2e-8;

	printf("i=%d, f=%f, f1=%.2f \n", i, f, f1);
	printf("f2=%f \n", f2);
	printf("f4=%f \n", f4);

	float weight;
	int age;
	scanf_s("%f %d", &weight, &age);
	printf("weight=%0.2f, age=%d", weight, age);

	getchar();
	getchar();
	getchar();
	getchar();
	return 0;
}

运行

1111.png

标签: C语言

Powered by emlog  蜀ICP备18021003号   sitemap

川公网安备 51019002001593号