当前位置:网站首页>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
边栏推荐
- Logic regression principle and code implementation
- Remember using Ali Font Icon Library for the first time
- Identification verification code
- C1 notes [task training part 2]
- Batch export ArcGIS attribute table
- How to read literature
- Realsense selection comparison d455 d435i d415 t265 3D hardware comparison
- Romance in C language
- Open source key component multi_ Button use, including test engineering
- 开源按键组件Multi_Button的使用,含测试工程
猜你喜欢

MySQL_ 01_ Simple data retrieval

Fashion classification case based on keras

Nat commun | current progress and open challenges of applied deep learning in Bioscience

云原生虚拟化:基于 Kubevirt 构建边缘计算实例

String function in MySQL
![[UDS unified diagnostic service] IV. typical diagnostic service (4) - online programming function unit (0x34-0x38)](/img/07/4814eb203dcca59416a7997bbedbf6.png)
[UDS unified diagnostic service] IV. typical diagnostic service (4) - online programming function unit (0x34-0x38)

cv_ Solution of mismatch between bridge and opencv
![[UDS unified diagnostic service] IV. typical diagnostic service (6) - input / output control unit (0x2F)](/img/ae/cbfc01fbcc816915b1794a9d70247a.png)
[UDS unified diagnostic service] IV. typical diagnostic service (6) - input / output control unit (0x2F)

Go语言JSON包使用

Docker 安装 MySQL
随机推荐
Go's gin framework learning
The JS timestamp of wechat applet is converted to / 1000 seconds. After six hours and one day, this Friday option calculates the time
C#字节数组(byte[])和字符串相互转换
Secure credit
Halo open source project learning (II): entity classes and data tables
C#的随机数生成
Summary of floating point double precision, single precision and half precision knowledge
The method of changing a value in the array and a value in the object of wechat applet
Format problems encountered in word typesetting
re正則錶達式
MySQL_01_简单数据检索
Halo 开源项目学习(二):实体类与数据表
Re expression régulière
Flash - Middleware
Selenium + phantom JS crack sliding verification 2
Auto.js 自定义对话框
Theory and practice of laser slam in dark blue College - Chapter 2 (odometer calibration)
Scikit learn sklearn 0.18 official document Chinese version
C# 的数据流加密与解密
Open source key component multi_ Button use, including test engineering