当前位置:网站首页>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
边栏推荐
- [UDS unified diagnostic service] (Supplement) v. detailed explanation of ECU bootloader development points (2)
- 2022 Shanghai safety officer C certificate operation certificate examination question bank and simulation examination
- Remember using Ali Font Icon Library for the first time
- Logic regression principle and code implementation
- Excel opens large CSV format data
- 2022江西光伏展,中國分布式光伏展會,南昌太陽能利用展
- C# 网络相关操作
- Thirteen documents in software engineering
- Batch export ArcGIS attribute table
- Listen for click events other than an element
猜你喜欢

Clion installation tutorial

re正则表达式

2022 Shanghai safety officer C certificate operation certificate examination question bank and simulation examination

Eigen learning summary

Open source key component multi_ Button use, including test engineering

Remember using Ali Font Icon Library for the first time

Halo 开源项目学习(二):实体类与数据表

Re regular expression

开源按键组件Multi_Button的使用,含测试工程

Cloud native Virtualization: building edge computing instances based on kubevirt
随机推荐
Utilisation de la liste - Ajouter, supprimer et modifier la requête
Summary of floating point double precision, single precision and half precision knowledge
[UDS unified diagnostic service] IV. typical diagnostic service (4) - online programming function unit (0x34-0x38)
JS get link? The following parameter name or value, according to the URL? Judge the parameters after
In JS, t, = > Analysis of
ES6 face test questions (reference documents)
读取excel,int 数字时间转时间
MySQL_01_简单数据检索
Docker 安装 MySQL
C language input and output (printf and scanf functions, putchar and getchar functions)
C language implements memcpy, memset, strcpy, strncpy, StrCmp, strncmp and strlen
_ FindText error
Operators in C language
Batch export ArcGIS attribute table
C1 notes [task training chapter I]
re正則錶達式
Using files to save data (C language)
Logic regression principle and code implementation
String function in MySQL
Flash - Middleware