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

边栏推荐
- What is the MySQL column to row function
- Niuke - Huawei question bank (51~60)
- Five skills of adding audio codec to embedded system
- 【C#】使用正则校验内容
- leetcode2312. 卖木头块(困难,周赛)
- 附加:信息脱敏;
- MySQL主从延迟问题怎么解决
- How does MySQL solve the problem of not releasing space after deleting a large amount of data
- Electronic Association C language level 1 33, odd even number judgment
- 1222. Password dropping (interval DP, bracket matching)
猜你喜欢

Leetcode face T10 (1-9) array, ByteDance interview sharing

Spend a week painstakingly sorting out the interview questions and answers of high-frequency software testing / automated testing

Types of exhibition items available in the multimedia interactive exhibition hall

Redis有序集合如何使用

How to batch add background and transition effects to videos?

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

pytest 测试框架

大厂裁员潮不断,双非本科出身的我却逆风翻盘挺进阿里

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

What is AQS and its principle
随机推荐
What is AQS and its principle
CSDN article underlined, font color changed, picture centered, 1 second to understand
Logging only errors to the console Set system property ‘log4j2. debug‘ to sh
[Video] Markov chain Monte Carlo method MCMC principle and R language implementation | data sharing
开发工具创新升级,鲲鹏推进计算产业“竹林”式生长
SQLite 3 of embedded database
Golang lock
Decipher the AI black technology behind sports: figure skating action recognition, multi-mode video classification and wonderful clip editing
trading
A quick understanding of digital electricity
essay structure
Construction and maintenance of business websites [12]
how to add one row in the dataframe?
医药管理系统(大一下C语言课设)
【深度学习】infomap 人脸聚类 facecluster
How to turn off debug information in rtl8189fs
Construction and maintenance of business websites [11]
Quality means doing it right when no one is looking
Webgpu (I): basic concepts
What style of Bluetooth headset is easy to use? High quality Bluetooth headset ranking