当前位置:网站首页>Implement a simple function to calculate the sum of all integers between M ~ n (m < n)
Implement a simple function to calculate the sum of all integers between M ~ n (m < n)
2022-04-23 18:02:00 【OceanKeeper1215】
Function interface definition :
int sum( int m, int n );
Sample referee test procedure :
#include <stdio.h>
int sum(int m, int n);
int main()
{
int m, n;
scanf("%d %d", &m, &n);
printf("sum = %d\n", sum(m, n));
return 0;
}
/* Your code will be embedded here */
sample input :
-5 8
sample output :
sum = 21
My answer :
int sum(int m,int n)
{
int he;
for(m,n;m<=n;m++){
he=he+m;
}
return he;
}
版权声明
本文为[OceanKeeper1215]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230545105387.html
边栏推荐
- Using files to save data (C language)
- Multi thread crawling Marco Polo network supplier data
- GDAL + ogr learning
- Operation of 2022 mobile crane driver national question bank simulation examination platform
- [UDS unified diagnostic service] IV. typical diagnostic service (4) - online programming function unit (0x34-0x38)
- Excel opens large CSV format data
- JS high frequency interview questions
- [UDS unified diagnostic service] v. diagnostic application example: Flash bootloader
- positioner
- Special effects case collection: mouse planet small tail
猜你喜欢
YOLOv4剪枝【附代码】
JS forms the items with the same name in the array object into the same array according to the name
Open source key component multi_ Button use, including test engineering
The ultimate experience, the audio and video technology behind the tiktok
2022 Jiangxi Photovoltaic Exhibition, China Distributed Photovoltaic Exhibition, Nanchang Solar Energy Utilization Exhibition
Auto. JS custom dialog box
Uniapp custom search box adaptation applet alignment capsule
Map basemap Library
Logic regression principle and code implementation
Welcome to the markdown editor
随机推荐
Crawl the product data of Xiaomi Youpin app
C network related operations
解决允许在postman中写入注释请求接口方法
Implementation of image recognition code based on VGg convolutional neural network
Amount input box, used for recharge and withdrawal
Realsense selection comparison d455 d435i d415 t265 3D hardware comparison
Flash operates on multiple databases
Implementation of k8s redis one master multi slave dynamic capacity expansion
Crawling mobile game website game details and comments (MQ + multithreading)
Format problems encountered in word typesetting
Thirteen documents in software engineering
Anchor location - how to set the distance between the anchor and the top of the page. The anchor is located and offset from the top
Tensorflow tensor introduction
ES6
Stanford machine learning course summary
Tell the truth of TS
Transfer learning of five categories of pictures based on VGg
C1 notes [task training part 2]
Fashion classification case based on keras
2022 Shanghai safety officer C certificate operation certificate examination question bank and simulation examination