当前位置:网站首页>【带你学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;
}
得分情况

边栏推荐
- Email picture attachment
- STM32F103 - two circuit PWM control motor
- 479. Additive binary tree (interval DP on the tree)
- Iterative unified writing method of binary tree
- Sword finger offer 29 Print matrix clockwise
- Cross domain? Homology? Understand what is cross domain at once
- How does MySQL solve the problem of not releasing space after deleting a large amount of data
- The wave of layoffs in big factories continues, but I, who was born in both non undergraduate schools, turned against the wind and entered Alibaba
- MySQL如何解决delete大量数据后空间不释放的问题
- [技术发展-21]:网络与通信技术的应用与发展快速概览-1- 互联网网络技术
猜你喜欢

Data analysis on the disaster of Titanic
![[graduation season] graduate seniors share how to make undergraduate more meaningful](/img/03/9adc44476e87b2499aa0ebb11cb247.png)
[graduation season] graduate seniors share how to make undergraduate more meaningful

【视频】马尔可夫链蒙特卡罗方法MCMC原理与R语言实现|数据分享

分卷压缩,解压

How to solve MySQL master-slave delay problem

No programming code technology! Four step easy flower store applet

Webgpu (I): basic concepts

PR second training

Software No.1

leetcode2310. The one digit number is the sum of integers of K (medium, weekly)
随机推荐
Selection of field types for creating tables in MySQL database
How to turn off debug information in rtl8189fs
Quality means doing it right when no one is looking
MySQL主从延迟问题怎么解决
Sword finger offer 29 Print matrix clockwise
Sword finger offer 62 The last remaining number in the circle
A quick understanding of digital electricity
[question] - why is optical flow not good for static scenes
RTL8189FS如何关闭Debug信息
Open that kind of construction document
Construction and maintenance of business websites [11]
Is the knowledge of University useless and outdated?
This is the report that leaders like! Learn dynamic visual charts, promotion and salary increase are indispensable
AR增强现实可应用的场景
How does MySQL solve the problem of not releasing space after deleting a large amount of data
[graduation season] graduate seniors share how to make undergraduate more meaningful
[Video] Markov chain Monte Carlo method MCMC principle and R language implementation | data sharing
How to use a product to promote "brand thrill"?
How to execute an SQL in MySQL
trading