c语言程序设计 请问 10 的 n 次方能用这样表示吗?

[复制链接]
查看11 | 回复1 | 2011-3-19 12:57:51 | 显示全部楼层 |阅读模式
#include stdio.h
main()
{
float a;int b;
printf(\"想保留几位??:\\n\");
scanf(\"%d\",
printf(\"输入你要计算的数字 :\\n\");
scanf(\"%f\",
a=a*(1.eb);
a=a .5;
a=(int)a;
a=(float)a/(1.eb);
printf(\"四舍五入=%f\\n\",a);
}
回复

使用道具 举报

千问 | 2011-3-19 12:57:51 | 显示全部楼层
<pre id=\"best-answer-content\" class=\"reply-text mb10\">1*10的n次方表示为1en。如1e-6表示1* 10^(-6),但要注意e后面只能给常量数字。不能给变量,const类型的变量也不行。当10的n次方n为变量时用pow函数(x的y次方表示为pow(x,y); ),用这个函数要用到#includemath.h这个头文件。

#include stdio.h
#include math.h
void main()
{
const int x = 4;
float a;int b;
printf(\"想保留几位??:\\n\");
scanf(\"%d\",
printf(\"输入你要计算的数字 :\\n\");
scanf(\"%f\",
a=a*pow(10,b);
a=a .5;
a=(int)a;
a=(float)a/pow(10,b);
printf(\"四舍五入=%f\\n\",a);
}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行