当前位置:网站首页>[learn C and fly] 4day Chapter 2 program in C language (exercise 2.5 generate power table and factorial table
[learn C and fly] 4day Chapter 2 program in C language (exercise 2.5 generate power table and factorial table
2022-07-02 02:16:00 【Try to be beautiful】
This series is all about puzzles A Free website - Just sign in every day
Knowledge point
pow(2,i) function
practice R7-1 Generate 2 The power table of
Enter a non negative integer n, Generate one 2 The power table of , Output 20~2n Value . Power function calculation can be called 2 Power of .
Input format :
The input gives a nonnegative integer on one line n.
Output format :
Output in ascending order of power n+1 That's ok , The format of each line is “pow(2,i) = 2 Of i The value of the power ”, Please note that there is a space to the left and right of the equal sign . The title ensures that the calculation result does not exceed the value range of integer .
sample input :
3
sample output :
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;
}
Scores

边栏推荐
- Leetcode face T10 (1-9) array, ByteDance interview sharing
- What is the MySQL column to row function
- es面试题
- Webgpu (I): basic concepts
- A quick understanding of digital electricity
- Ar Augmented Reality applicable scenarios
- [pit] how to understand "parameter fishing"
- essay structure
- CVPR 2022 | 大连理工提出自校准照明框架,用于现实场景的微光图像增强
- A quick understanding of analog electricity
猜你喜欢

附加:信息脱敏;

RTL8189FS如何关闭Debug信息

leetcode2309. The best English letters with both upper and lower case (simple, weekly)

Software No.1

JMeter (II) - install the custom thread groups plug-in

How to hide the scroll bar of scroll view in uniapp

Cesium dynamic diffusion point effect

734. Energy stone (greed, backpack)

479. Additive binary tree (interval DP on the tree)

CSDN article underlined, font color changed, picture centered, 1 second to understand
随机推荐
Construction and maintenance of business websites [13]
Types of exhibition items available in the multimedia interactive exhibition hall
JVM interview
What is the MySQL column to row function
leetcode2309. 兼具大小写的最好英文字母(简单,周赛)
Architecture evolution from MVC to DDD
leetcode2312. 卖木头块(困难,周赛)
MySQL主从延迟问题怎么解决
[technology development -21]: rapid overview of the application and development of network and communication technology -1- Internet Network Technology
剑指 Offer 62. 圆圈中最后剩下的数字
剑指 Offer 29. 顺时针打印矩阵
JPM 2021 most popular paper released (with download)
How to execute an SQL in MySQL
剑指 Offer II 031. 最近最少使用缓存
Infix expression to suffix expression (computer) code
How to use redis ordered collection
If you want to rewind the video picture, what simple methods can you use?
STM32F103 - two circuit PWM control motor
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
2022 Q2 - 提升技能的技巧总结