当前位置:网站首页>[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
边栏推荐
- 剑指 Offer 31. 栈的压入、弹出序列
- If you want to rewind the video picture, what simple methods can you use?
- Architecture evolution from MVC to DDD
- Pat a-1165 block reversing (25 points)
- 正则表达式学习笔记
- mysql列转行函数指的是什么
- Construction and maintenance of business websites [15]
- Post infiltration flow encryption
- C write TXT file
- DNS domain name resolution
猜你喜欢
A quick understanding of analog electricity
Selection of field types for creating tables in MySQL database
leetcode2305. Fair distribution of biscuits (medium, weekly, shaped pressure DP)
JPM 2021 most popular paper released (with download)
leetcode2310. The one digit number is the sum of integers of K (medium, weekly)
How to hide the scroll bar of scroll view in uniapp
An analysis of circuit for quick understanding
leetcode373. 查找和最小的 K 对数字(中等)
【liuyubobobo-玩转Leetcode算法面试】【00】课程概述
Ar Augmented Reality applicable scenarios
随机推荐
If you want to rewind the video picture, what simple methods can you use?
From January 11, 2007 to January 11, 2022, I have been in SAP Chengdu Research Institute for 15 years
CVPR 2022 | 大连理工提出自校准照明框架,用于现实场景的微光图像增强
【带你学c带你飞】4day第2章 用C语言编写程序(练习 2.5 生成乘方表与阶乘表
leetcode2312. 卖木头块(困难,周赛)
剑指 Offer 29. 顺时针打印矩阵
剑指 Offer II 031. 最近最少使用缓存
Es interview questions
Bash bounce shell encoding
The middle element and the rightmost element of the shutter
mysql列转行函数指的是什么
No programming code technology! Four step easy flower store applet
Cesium dynamic diffusion point effect
Kibana controls es
[deep learning] Infomap face clustering facecluster
* and & symbols in C language
How to build and use redis environment
剑指 Offer 31. 栈的压入、弹出序列
Sword finger offer 29 Print matrix clockwise
Selection of field types for creating tables in MySQL database