.编写程序,计算2的n次方.其中n为整数.注意n可能是正整数、负整数或0.
人气:488 ℃ 时间:2020-06-23 07:37:55
解答
#include#includevoid main(){int n,s;double s0;printf("本程序计算2的n次方,请输入次数n:\n");scanf("%d",&n);if(n>=0){s=pow(2.0,n);printf("%d\n",s);}else{s0=1.0/pow(2.0,abs(n));printf("%f\n",s0);}}...
推荐
猜你喜欢
- 我很高兴来到初一五班英语 好像是I am very happy to come to啥啥的·急求啊
- 风吹杨柳千门绿下一句
- 1、在一减法算式中,被减数、减数与差的和是18,已知差是减数的五分之二,那么减数是( ),差是( ) 2、
- 已知数列(an)的前n项和Sn=3n^2-n/2,依次取出该数列的第2项,第4项,第8项……第2^n项
- He walked his dog yesterday evening.同义句转换.He( )his dog( )( )( ).
- 一头牛被一条长5m的绳子拴在树上,它能吃到草的最大面积是多少平方米
- 用同样大小的黑色棋子按图所示的方式摆图形,按照这样的规律摆下去,则第n个图形需棋子_枚.(用含n的代数式表示)
- 设f(x)是定义在R上的奇函数,且在(0,正无穷)上单调递减,又f(-3)=0,则xf(x)>0的解集为?