当前位置:网站首页>Function: write function fun to find s=1^k+2^k +3^k ++ The value of n^k, (the cumulative sum of the K power of 1 to the K power of n).
Function: write function fun to find s=1^k+2^k +3^k ++ The value of n^k, (the cumulative sum of the K power of 1 to the K power of n).
2022-07-04 00:41:00 【CTGU-Yoghurt】
subject :
Code details :
#define K 4
#define N 5
#include <stdio.h>
long fun(int n, int k)
{
/**********Program**********/
long sum = 1,i,j,t;
for (i = 2; i <= n; i++)
{
t = 1;
for (j = 1; j <= k; j++)
{
t *= i;
}
sum += t;
}
return sum;
/********** End **********/
}
int main()
{
long int sum;
printf("Sum of %d powers of integers from 1 to %d = ", K, N);
sum = fun(N, K);
printf("%ld\n", sum);
}
边栏推荐
- [about text classification trick] things you don't know
- 不得不会的Oracle数据库知识点(二)
- Sequence list and linked list
- Employees' turnover intention is under the control of the company. After the dispute, the monitoring system developer quietly removed the relevant services
- AI Challenger 2018 text mining competition related solutions and code summary
- Weekly open source project recommendation plan
- Qtcharts notes (V) scatter diagram qscatterseries
- Understanding of Radix
- Shell script three swordsman sed
- Swagger2 quick start and use
猜你喜欢

ESP Arduino playing with peripherals (V) basic concept of interrupt and timer interrupt
![[common error] UART cannot receive data error](/img/77/6ba56ce6e64beeb73a77d04af5bd0f.jpg)
[common error] UART cannot receive data error

Analysis: misunderstanding of choosing WMS warehouse management system
![[PHP basics] cookie basics, application case code and attack and defense](/img/7c/551b79fd5dd8a411de85c800c3a034.jpg)
[PHP basics] cookie basics, application case code and attack and defense

功能:求出菲波那契数列的前一项与后一项之比的极限的 近似值。例如:当误差为0.0001时,函数值为0.618056。
![Several ways to set up a blog locally [attach relevant software download links]](/img/2f/51a09d9ef71065319ed90306517854.jpg)
Several ways to set up a blog locally [attach relevant software download links]
![[error record] configure NDK header file path in Visual Studio](/img/9f/89f68c037dcf68a31a2de064dd8471.jpg)
[error record] configure NDK header file path in Visual Studio

Employees' turnover intention is under the control of the company. After the dispute, the monitoring system developer quietly removed the relevant services

Cannot build artifact 'test Web: War expanded' because it is included into a circular depend solution
![[prefix and notes] prefix and introduction and use](/img/a6/a75e287ac481559d8f733e6ca3e59c.jpg)
[prefix and notes] prefix and introduction and use
随机推荐
2-redis architecture design to use scenarios - four deployment and operation modes (Part 2)
ITK learning notes (VII) the position of ITK rotation direction remains unchanged
12. Go implementation of integer to Roman numeral and leetcode
Beijing invites reporters and media
A Kuan food rushed to the Shenzhen Stock Exchange: with annual sales of 1.1 billion, Hillhouse and Maotai CCB are shareholders
Severity code description the project file line prohibits the display of status error c4996 fopen ('fscanf ', StrCmp): this function or variable may be unsafe The most comprehensive solution
ISBN number
(Video + graphics and text) introduction to machine learning series - Chapter 4 naive Bayes
Makefile judge custom variables
How to be a professional software testing engineer? Listen to the byte five year old test
What insurance products should be bought for the elderly?
Swagger2 quick start and use
leetcode 121 Best Time to Buy and Sell Stock 买卖股票的最佳时机(简单)
[common error] UART cannot receive data error
AI Challenger 2018 text mining competition related solutions and code summary
ESP Arduino playing with peripherals (V) basic concept of interrupt and timer interrupt
Is the low commission link on the internet safe? How to open an account for China Merchants Securities?
Global and Chinese markets of distributed control system (DCS) consumption 2022-2028: Research Report on technology, participants, trends, market size and share
Release and visualization of related data
Suggestions for improving code quality