当前位置:网站首页>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
边栏推荐
- Yolov4 pruning [with code]
- Re regular expression
- QTableWidget使用讲解
- Build openstack platform
- Vite configure proxy proxy to solve cross domain
- Basic usage of crawler requests
- Crawler for querying nicknames and avatars based on qqwebapi
- Detailed deployment of flask project
- Fashion classification case based on keras
- Map basemap Library
猜你喜欢
C# 网络相关操作
MySQL_01_简单数据检索
Transfer learning of five categories of pictures based on VGg
Qtablewidget usage explanation
[UDS unified diagnostic service] v. diagnostic application example: Flash bootloader
Clion installation tutorial
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
解决报错max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[UDS unified diagnostic service] (Supplement) v. detailed explanation of ECU bootloader development points (2)
Logic regression principle and code implementation
随机推荐
An example of linear regression based on tensorflow
解决允许在postman中写入注释请求接口方法
.105Location
587. Install fence / Sword finger offer II 014 Anagrams in strings
C1 notes [task training chapter I]
Yolov4 pruning [with code]
Jenkspy package installation
Tell the truth of TS
Timestamp to formatted date
MySQL_ 01_ Simple data retrieval
C1小笔记【任务训练篇一】
Logic regression principle and code implementation
Multi thread crawling Marco Polo network supplier data
Go's gin framework learning
读取excel,int 数字时间转时间
.105Location
2022江西储能技术展会,中国电池展,动力电池展,燃料电池展
word frequency count
Crawl the product data of Xiaomi Youpin app
mysql自动启动设置用Systemctl start mysqld启动