当前位置:网站首页>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);
}
边栏推荐
- From functools import reduce -- see the use of reduce function from typical examples
- 1-Redis架构设计到使用场景-四种部署运行模式(上)
- (Video + graphics and text) introduction to machine learning series - Chapter 4 naive Bayes
- [2021]NeRF in the Wild: Neural Radiance Fields for Unconstrained Photo Collections
- How to be a professional software testing engineer? Listen to the byte five year old test
- A Kuan food rushed to the Shenzhen Stock Exchange: with annual sales of 1.1 billion, Hillhouse and Maotai CCB are shareholders
- Celebrate the new year | Suihua fire rescue detachment has wonderful cultural activities during the Spring Festival
- From functional testing to automated testing, how did I successfully transform my salary to 15K +?
- Beijing invites reporters and media
- [NLP] text classification still stays at Bert? Duality is too strong than learning framework
猜你喜欢
![[common error] custom IP instantiation error](/img/de/d3f90cd224274d87fcf153bb9244d7.jpg)
[common error] custom IP instantiation error

Sequence list and linked list

Is it really possible that the monthly salary is 3K and the monthly salary is 15K?

打印菱形图案

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

Software testers, how can you quickly improve your testing skills? Ten minutes to teach you

Windos10 reinstallation system tutorial

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

The difference between objects and objects
![[cloud native topic -48]:kubesphere cloud Governance - operation - overview of multi tenant concept](/img/b4/961b3b44e9ecbfd4bddd04318b663a.jpg)
[cloud native topic -48]:kubesphere cloud Governance - operation - overview of multi tenant concept
随机推荐
It's OK to have hands-on 8 - project construction details 3-jenkins' parametric construction
Is it really possible that the monthly salary is 3K and the monthly salary is 15K?
[C language] break and continue in switch statement
It is worthy of "Alibaba internal software test interview notes" from beginning to end, all of which are essence
Analysis: misunderstanding of choosing WMS warehouse management system
[dynamic programming] leetcode 53: maximum subarray sum
不得不会的Oracle数据库知识点(一)
Development and application of fcitx functional plug-ins
Generic
Wechat official account and synchronization assistant
URL (data:image/png; Base64, ivborw0k... Use case
Detailed explanation of the relationship between Zhongtai, wechat and DDD
[prefix and notes] prefix and introduction and use
删除所有值为y的元素。数组元素中的值和y的值由主函数通过键盘输入。
Global and Chinese markets for blood and liquid heating devices 2022-2028: Research Report on technology, participants, trends, market size and share
The FISCO bcos console calls the contract and reports an error does not exist
[complimentary ppt] kubemeet Chengdu review: make the delivery and management of cloud native applications easier!
Global and Chinese market of process beer equipment 2022-2028: Research Report on technology, participants, trends, market size and share
A-Frame虚拟现实开发入门
Global and Chinese markets of distributed control system (DCS) consumption 2022-2028: Research Report on technology, participants, trends, market size and share