浮点数包括有符号和无符号的小数和小数。
有符号包括正数和负数。
无符号数字只能包含正值。
浮点数的示例如下表所示。
09.1234
3428.12
112.12345
-342.66
-12345.12345
使用关键字float
来声明浮点数。以下代码声明了三个名为:operand1
,operand2
和result
的浮点变量数据类型。
#include <stdio.h>
int main(){ /*from w w w . ja v a 2s . c om*/
float operand1;
float operand2;
float result;
printf(three float numbers declared.\n);
float f1 = 1.25;
float f2 = 250;
printf(f1=f%, f2=%f2 \n, f1, f2);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。