当前位置:网站首页>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);
}
边栏推荐
- On the day when 28K joined Huawei testing post, I cried: everything I have done in these five months is worth it
- Cloud dial test helps Weidong cloud education to comprehensively improve the global user experience
- On covariance of array and wildcard of generic type
- Collation of the most complete Chinese naturallanguageprocessing data sets, platforms and tools
- Swagger2 quick start and use
- Recommendation of knowledge base management system
- MySQL 8.0.12 error: error 2013 (HY000): lost connection to MySQL server during query
- Understanding of Radix
- [CSDN Q & A] experience and suggestions
- [complimentary ppt] kubemeet Chengdu review: make the delivery and management of cloud native applications easier!
猜你喜欢
Recommendation of knowledge base management system
Pytest unit test framework: simple and easy to use parameterization and multiple operation modes
What does redis do? Redis often practices grammar every day
Regular expressions and text processors for shell programming
[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)
P3371 [template] single source shortest path (weakened version)
[common error] UART cannot receive data error
Joint examination of six provinces 2017
Reading notes on how programs run
Windos10 reinstallation system tutorial
随机推荐
[PHP basics] session basic knowledge, application case code and attack and defense
Subgraph isomorphism -subgraph isomorphism
12. Go implementation of integer to Roman numeral and leetcode
gslb(global server load balance)技术的一点理解
What is the potential of pocket network, which is favored by well-known investors?
1-Redis架构设计到使用场景-四种部署运行模式(上)
[complimentary ppt] kubemeet Chengdu review: make the delivery and management of cloud native applications easier!
GUI 应用:socket 网络聊天室
Global and Chinese market of melting furnaces 2022-2028: Research Report on technology, participants, trends, market size and share
2-redis architecture design to use scenarios - four deployment and operation modes (Part 2)
老姜的特点
MySQL 8.0.12 error: error 2013 (HY000): lost connection to MySQL server during query
What is regression testing? Talk about regression testing in the eyes of Ali Test Engineers
MPLS experiment
It's OK to have hands-on 8 - project construction details 3-jenkins' parametric construction
[CSDN Q & A] experience and suggestions
2-Redis架构设计到使用场景-四种部署运行模式(下)
Collation of the most complete Chinese naturallanguageprocessing data sets, platforms and tools
【leetcode】300. Longest increasing subsequence (dynamic programming, dichotomy)
我管你什么okr还是kpi,PPT轻松交给你