当前位置:网站首页>Daily practice of C language - day 4: find the sum of all even numbers within 100
Daily practice of C language - day 4: find the sum of all even numbers within 100
2022-06-28 11:57:00 【Wang Youduo】
#include<stdio.h>
#define INTEGER_RANGE 100
int main()
{
int i = 1;
int sum = 0;
for(i = 1; i <= INTEGER_RANGE; i++)
{
if(i % 2 == 0)
sum += i;
}
printf("%d The sum of all even numbers within is %d" , INTEGER_RANGE , sum);
return 0;
}
边栏推荐
- Still using simpledateformat for time formatting? Be careful that the project collapses!
- Simulation of the Saier lottery to seek expectation
- Day29 JS notes 2021.09.23
- Excel import / export convenience tool class
- js中this的默认指向及如何修改指向 2021.11.09
- The default point of this in JS and how to modify it to 2021.11.09
- Redis6 1: what problems can be solved by the introduction of NoSQL and redis?
- 分析list中有无重复数据且重复了几次
- 基于验证码识别的机器学习项目captcha_trainer操作实践
- On the output representation of bidirectional LSTM in pytoch
猜你喜欢

Get current system date

Using soapUI to obtain freemaker's FTL file template

Fancy features and cheap prices! What is the true strength of Changan's new SUV?

太阳能无线LED显示屏的特点

QML control type: tabbar

Graphics view framework for QT learning (to realize startup animation)

Recommended practice sharing of Zhilian recruitment based on Nebula graph

纯纯大怨种!那些年被劝退的考研专业

Training notice | special training notice on epidemic prevention and security prevention for overseas Chinese funded enterprises, institutions and personnel in 2022

Simulation of the Saier lottery to seek expectation
随机推荐
day30 js笔记 BOM和DOM 2021.09.24
功能真花哨,价格真便宜!长安全新SUV真实力到底怎样?
工作组环境下的内网渗透:一些基础打法
Necessary for beginners PR 2021 quick start tutorial, PR green screen matting operation method
MapReduce项目案例1
Random forest and poetry maker trained by AMR
Makefile introduction
Redis hash hash type string (5)
董宇辉,新东方以及凤凰卫视
毕业了
[sciter]: use of sciter FS module scanning file API and its details
面试步骤的面试技巧
近况
TiDB v6.0.0 (DMR) :缓存表初试丨TiDB Book Rush
Open3d manual clipping point cloud
Allez, Meta - Cosme, comme prévu, cette chaleur ne durera pas longtemps.
day34 js笔记 正则表达式 2021.09.29
Day36 JS notes ecma6 syntax 2021.10.09
Dongyuhui, New Oriental and Phoenix Satellite TV
Solutions to connection failures and errors when accessing mysql8 using the SSM project