啊哈磊_编程从这里起步
标题:
求助:计算二的幂
[打印本页]
作者:
277668922
时间:
2017-7-30 08:40
标题:
求助:计算二的幂
#include <stdio.h>
int main()
{
int i,m;
int s;
scanf("%d",&m);
for(i=0;i<m;i++)
s*=2;
printf("%d",s);
return 0;
}
一直不能通过,求助
作者:
vvvsc0
时间:
2017-8-3 11:24
本帖最后由 vvvsc0 于 2017-8-3 11:25 编辑
你是要求2的s次幂吗?改下:long long s;int s_1;s_1 = s;
for(i = 0;i < s;i++)
s*=s_1;
作者:
嫣然一笑嘿嘿嘿
时间:
2017-9-7 18:35
用函数啊,这是头文件:
#include<math.h>
这是函数:
pow(2,s)
作者:
jhx
时间:
2017-10-25 19:28
变量s应该赋值为1
作者:
1138905368
时间:
2018-3-2 20:07
paw函数直接完成
作者:
创世菌
时间:
2018-3-3 09:22
哪里需要什么 pow!
看招:
[mw_shl_code=c,true]#include <stdio.h>
int main()
{
int m;
scanf("%d",&m);
printf("%d",1<<m);
return 0;
}[/mw_shl_code]
欢迎光临 啊哈磊_编程从这里起步 (https://bbs.codeaha.com/)
Powered by Discuz! X3.2