当前位置:网站首页>[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

边栏推荐
- This is the report that leaders like! Learn dynamic visual charts, promotion and salary increase are indispensable
- Cesium dynamic diffusion point effect
- Construction and maintenance of business websites [15]
- MySQL主从延迟问题怎么解决
- Redis环境搭建和使用的方法
- Webgpu (I): basic concepts
- es面試題
- The basic steps of using information theory to deal with scientific problems are
- How to execute an SQL in MySQL
- Design and implementation of key value storage engine based on LSM tree
猜你喜欢

leetcode2312. Selling wood blocks (difficult, weekly race)

1069. Division of convex polygons (thinking, interval DP)

SQLite 3 of embedded database

MySQL主从延迟问题怎么解决

Summary of some experiences in the process of R & D platform splitting

附加:信息脱敏;

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

How does MySQL solve the problem of not releasing space after deleting a large amount of data

From January 11, 2007 to January 11, 2022, I have been in SAP Chengdu Research Institute for 15 years

JVM面试篇
随机推荐
Comparative analysis of MVC, MVP and MVVM, source code analysis
【带你学c带你飞】3day第2章 用C语言编写程序(练习 2.3 计算分段函数)
MySQL operates the database through the CMD command line, and the image cannot be found during the real machine debugging of fluent
C return multiple values getter setter queries the database and adds the list return value to the window
Infix expression to suffix expression (computer) code
SQLite 3 of embedded database
JVM interview
mysql列转行函数指的是什么
Sword finger offer 29 Print matrix clockwise
Sword finger offer 47 Maximum value of gifts
Sword finger offer II 031 Least recently used cache
golang---锁
Medical management system (C language course for freshmen)
【OpenCV】-5种图像滤波的综合示例
剑指 Offer II 031. 最近最少使用缓存
How to turn off the LED light of Rog motherboard
LFM信号加噪、时频分析、滤波
leetcode2309. 兼具大小写的最好英文字母(简单,周赛)
Start from scratch - Web Host - 01
Kibana controls es