当前位置:网站首页>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);
}
边栏推荐
- What are the application fields of digital twins in industry?
- [error record] configure NDK header file path in Visual Studio
- 功能:求5行5列矩阵的主、副对角线上元素之和。注意, 两条对角线相交的元素只加一次。例如:主函数中给出的矩阵的两条对角线的和为45。
- Stock price forecast
- HR disgusted interview behavior
- Collation of the most complete Chinese naturallanguageprocessing data sets, platforms and tools
- Wechat official account and synchronization assistant
- system. Exit (0) and system exit(1)
- Entropy and full connection layer
- Joint examination of six provinces 2017
猜你喜欢

我管你什么okr还是kpi,PPT轻松交给你

Recommendation of knowledge base management system

Axure resources and prototype tool Axure RP 9 download

Struct in linked list

Regular expressions and text processors for shell programming

(Video + graphics and text) introduction to machine learning series - Chapter 4 naive Bayes
![P3371 [template] single source shortest path (weakened version)](/img/c5/bcb22e1ea573253005e56ebbd73bb7.jpg)
P3371 [template] single source shortest path (weakened version)

NLP Chinese corpus project: large scale Chinese natural language processing corpus

Beijing invites reporters and media
![[2021]NeRF in the Wild: Neural Radiance Fields for Unconstrained Photo Collections](/img/c6/3dc7d01600f6713afdbb4cf3df5238.jpg)
[2021]NeRF in the Wild: Neural Radiance Fields for Unconstrained Photo Collections
随机推荐
Makefile judge custom variables
NLP Chinese corpus project: large scale Chinese natural language processing corpus
Why use get/set instead of exposing properties
挖财帮个人开的证券账户安全吗?是不是有套路
What is regression testing? Talk about regression testing in the eyes of Ali Test Engineers
Future source code view -juc series
From functional testing to automated testing, how did I successfully transform my salary to 15K +?
Recommendation of knowledge base management system
Employees' turnover intention is under the control of the company. After the dispute, the monitoring system developer quietly removed the relevant services
Generic
ITK learning notes (VII) the position of ITK rotation direction remains unchanged
Is it really possible that the monthly salary is 3K and the monthly salary is 15K?
What insurance products should be bought for the elderly?
功能:编写函数fun求s=1^k+2^k +3^k + ......+N^k的值, (1的K次方到N的K次方的累加和)。
[error record] configure NDK header file path in Visual Studio
Global and Chinese market of process beer equipment 2022-2028: Research Report on technology, participants, trends, market size and share
Suggestions for improving code quality
[complimentary ppt] kubemeet Chengdu review: make the delivery and management of cloud native applications easier!
Collation of the most complete Chinese naturallanguageprocessing data sets, platforms and tools
[error record] configure NDK header file path in Visual Studio (three header file paths of NDK | ASM header file path selection related to CPU architecture)