当前位置:网站首页>[C language] power table of 3 generated by PTA 7-53
[C language] power table of 3 generated by PTA 7-53
2022-07-29 04:29:00 【LastWhisperw】
Enter a non negative integer n, Generate one 3 The power table of , Output 3^0~3^n Value . Power function calculation can be called 3 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(3,i) = 3 Of i The value of the power ”. Ensure that the output data does not exceed the range of long integers .
sample input :
3No blank lines at the end
sample output :
pow(3,0) = 1
pow(3,1) = 3
pow(3,2) = 9
pow(3,3) = 27No blank lines at the end
pow(a,b) Is to seek a^b Function of . To use this function, you need to include math.h This header file
#include<stdio.h>
#include<math.h>
int main(){
int n;
scanf("%d",&n) ;
int i;
for(i=0;i<=n;i++){
int a=pow(3,i);
printf("pow(3,%d) = %d\n",i,a);
}
return 0;
}边栏推荐
- 15.federation
- 读懂 互联网巨头 【中台之战】 以及 中台 发展思维
- 不会就坚持63天吧 最大的异或
- Redux quick start
- DASCTF2022.07赋能赛
- [material delivery UAV] record (ROS + Px4 + yolov5 + esp8266 + steering gear)
- The principle of inverse Fourier transform (IFFT) in signal processing
- leetcode 686.重复叠加字符串 KMP方法(C语言实现)
- 通过js来实现一元二次方程的效果,输入a,b,c系数后可计算出x1和x2的值
- Shell string segmentation
猜你喜欢

HC06 HC05 BT

The principle of inverse Fourier transform (IFFT) in signal processing

Machine vision series 3:vs2019 opencv environment configuration

Unity基础(3)—— unity中的各种坐标系

It won't last for 65 days. It only appears once

Laya中的A星寻路

Machine vision Series 2: vs DLL debugging

MySQL - 深入解析MySQL索引数据结构

TypeError: Cannot read properties of undefined (reading ‘then‘)

Introduction and examples of parameters in Jenkins parametric construction
随机推荐
顺序表和链表
Understand the Internet giant [the war between China and Taiwan] and the development thinking of China and Taiwan
Exception resolution: error of not finding edu.stanford.nlp.semgraph.semgrex.semgrexpattern in cococaption package
Niuke IOI weekly 27 popularity group
不会就坚持58天吧 实现前缀树
Deploy Jenkins using containers
[material delivery UAV] record (ROS + Px4 + yolov5 + esp8266 + steering gear)
Kotlin's list, map, set and other collection classes do not specify types
C language: enumerating knowledge points summary
Make a virtual human with zego avatar | virtual anchor live broadcast solution
Two forms of softmax cross entropy + numpy implementation
Log configuration logback
不会就坚持65天吧 只出现一次的数字
【Express连接MySQL数据库】
9. Delay queue
Pytorch fixed random seed & recurrence model
JVM (heap and stack) memory allocation
Why is it necessary to scale the attention before softmax (why divide by the square root of d_k)
LeetCode_ Stack topics
Laya中的A星寻路