当前位置:网站首页>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);
}
边栏推荐
- MySQL winter vacation self-study 2022 12 (2)
- A method to solve Bert long text matching
- For loop
- What is the future of software testing industry? Listen to the test veterans' answers
- AI Challenger 2018 text mining competition related solutions and code summary
- Suggestions for improving code quality
- A Kuan food rushed to the Shenzhen Stock Exchange: with annual sales of 1.1 billion, Hillhouse and Maotai CCB are shareholders
- MySQL winter vacation self-study 2022 12 (1)
- Data storage - interview questions
- Future source code view -juc series
猜你喜欢

Axure resources and prototype tool Axure RP 9 download
![[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

Entropy and full connection layer

Alibaba test engineer with an annual salary of 500000 shares notes: a complete set of written tests of software testing

The difference between objects and objects

It's OK to have hands-on 8 - project construction details 3-jenkins' parametric construction

What is the potential of pocket network, which is favored by well-known investors?

From functional testing to automated testing, how did I successfully transform my salary to 15K +?

MySQL winter vacation self-study 2022 12 (1)

Cannot build artifact 'test Web: War expanded' because it is included into a circular depend solution
随机推荐
挖财帮个人开的证券账户安全吗?是不是有套路
[cloud native topic -48]:kubesphere cloud Governance - operation - overview of multi tenant concept
Pair
数据库表外键的设计
How to be a professional software testing engineer? Listen to the byte five year old test
From functools import reduce -- see the use of reduce function from typical examples
[about text classification trick] things you don't know
On the day when 28K joined Huawei testing post, I cried: everything I have done in these five months is worth it
Solution to the impact of Remote Code Execution Vulnerability of log4j2 component on December 9, 2021
MySQL 8.0.12 error: error 2013 (HY000): lost connection to MySQL server during query
关于 uintptr_t和intptr_t 类型
What is the future of software testing industry? Listen to the test veterans' answers
[GNN] hard core! This paper combs the classical graph network model
Similarities and differences of text similarity between Jaccard and cosine
Is the account opening of Guoyuan securities really safe and reliable
手机异步发送短信验证码解决方案-Celery+redis
Cannot build artifact 'test Web: War expanded' because it is included into a circular depend solution
[2021]NeRF in the Wild: Neural Radiance Fields for Unconstrained Photo Collections
Global and Chinese market of glossometer 2022-2028: Research Report on technology, participants, trends, market size and share
Test the influence of influent swacth on the electromagnetic coil of quartz meter