当前位置:网站首页>【带你学c带你飞】4day第2章 用C语言编写程序(练习 2.5 生成乘方表与阶乘表
【带你学c带你飞】4day第2章 用C语言编写程序(练习 2.5 生成乘方表与阶乘表
2022-07-02 02:11:00 【尽力漂亮】
知识点
pow(2,i)函数
练习 R7-1 生成2的乘方表
输入一个非负整数n,生成一张2的乘方表,输出20~2n的值。可调用幂函数计算2的乘方。
输入格式:
输入在一行中给出一个非负整数n。
输出格式:
按照幂的递增顺序输出n+1行,每行格式为“pow(2,i) = 2的i次幂的值”,请注意等号的左右各有一个空格。题目保证计算结果不超过整数的取值范围。
输入样例:
3
输出样例:
pow(2,0) = 1
pow(2,1) = 2
pow(2,2) = 4
pow(2,3) = 8
demo
#include <stdio.h>
#include <math.h>
int main()
{
int i,n;
int p;
scanf("%d",&n);
for(i=0;i<=n;i++){
p=pow(2,i);
printf("pow(2,%d) = %d\n",i,p);
}
return 0;
}
得分情况

边栏推荐
- The smart Park "ZhongGuanCun No.1" subverts your understanding of the park
- 剑指 Offer 31. 栈的压入、弹出序列
- 花一个星期时间呕心沥血整理出高频软件测试/自动化测试面试题和答案
- MySQL主从延迟问题怎么解决
- Is the knowledge of University useless and outdated?
- 跨域?同源?一次搞懂什么是跨域
- MySQL中一条SQL是怎么执行的
- leetcode2310. The one digit number is the sum of integers of K (medium, weekly)
- leetcode2312. 卖木头块(困难,周赛)
- Sword finger offer 31 Stack push in and pop-up sequence
猜你喜欢
![[Video] Markov chain Monte Carlo method MCMC principle and R language implementation | data sharing](/img/ba/dcb276768b1a9cc84099f093677d29.png)
[Video] Markov chain Monte Carlo method MCMC principle and R language implementation | data sharing

剑指 Offer 62. 圆圈中最后剩下的数字

The concepts and differences between MySQL stored procedures and stored functions, as well as how to create them, the role of delimiter, the viewing, modification, deletion of stored procedures and fu

leetcode2310. 个位数字为 K 的整数之和(中等,周赛)

【毕业季】研究生学长分享怎样让本科更有意义

leetcode2312. Selling wood blocks (difficult, weekly race)
![[question] - why is optical flow not good for static scenes](/img/8d/2cf6f582bc58cc2985f50e3f85f334.jpg)
[question] - why is optical flow not good for static scenes

Cross domain? Homology? Understand what is cross domain at once

How to execute an SQL in MySQL
![[Video] visual interpretation of Markov chain principle and Mrs example of R language region conversion | data sharing](/img/56/87bc8fca9ceeab6484f567f7231fdb.png)
[Video] visual interpretation of Markov chain principle and Mrs example of R language region conversion | data sharing
随机推荐
Types of exhibition items available in the multimedia interactive exhibition hall
MySQL如何解决delete大量数据后空间不释放的问题
How to debug apps remotely and online?
Software No.1
【视频】马尔可夫链原理可视化解释与R语言区制转换MRS实例|数据分享
How to execute an SQL in MySQL
Volume compression, decompression
Opencascade7.6 compilation
JMeter (II) - install the custom thread groups plug-in
2022 Q2 - 提升技能的技巧总结
New news, Wuhan Yangluo international port, filled with black technology, refreshes your understanding of the port
Selection of field types for creating tables in MySQL database
How to build and use redis environment
Redis有序集合如何使用
Quality means doing it right when no one is looking
CSDN insertion directory in 1 second
RTL8189FS如何关闭Debug信息
JPM 2021 most popular paper released (with download)
The middle element and the rightmost element of the shutter
花一个星期时间呕心沥血整理出高频软件测试/自动化测试面试题和答案