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

边栏推荐
- essay structure
- leetcode2305. Fair distribution of biscuits (medium, weekly, shaped pressure DP)
- How to solve MySQL master-slave delay problem
- STM32F103 - two circuit PWM control motor
- 剑指 Offer 31. 栈的压入、弹出序列
- Ar Augmented Reality applicable scenarios
- 剑指 Offer 62. 圆圈中最后剩下的数字
- Duplicate keys detected: ‘0‘. This may cause an update error. found in
- mysql列转行函数指的是什么
- 剑指 Offer II 031. 最近最少使用缓存
猜你喜欢

JVM interview

Redis有序集合如何使用
![[opencv] - comprehensive examples of five image filters](/img/c7/aec9f2e03a17c22030d7813dd47c48.png)
[opencv] - comprehensive examples of five image filters

RTL8189FS如何关闭Debug信息

Software No.1

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

Comparative analysis of MVC, MVP and MVVM, source code analysis

query词权重, 搜索词权重计算

The basic steps of using information theory to deal with scientific problems are

LFM信号加噪、时频分析、滤波
随机推荐
Golang lock
Calculation (computer) code of suffix expression
leetcode2311. Longest binary subsequence less than or equal to K (medium, weekly)
leetcode2309. 兼具大小写的最好英文字母(简单,周赛)
Redis环境搭建和使用的方法
Kibana操控ES
How to use redis ordered collection
leetcode373. Find and minimum k-pair numbers (medium)
Opencascade7.6 compilation
Open那啥的搭建文档
Selection of field types for creating tables in MySQL database
Webgpu (I): basic concepts
SQL server calculates the daily average and annual average of the whole province
Deep learning: a solution to over fitting in deep neural networks
Post infiltration flow encryption
Cesium dynamic diffusion point effect
MySQL约束与多表查询实例分析
CSDN insertion directory in 1 second
how to come in an investnent bank team
【带你学c带你飞】4day第2章 用C语言编写程序(练习 2.5 生成乘方表与阶乘表