欧拉计划第1题
2018-02-25 17:46
148 查看
这一题是题库的第一题,应该算是题库中最简单的一道题了
Problem1:If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.Find the sum of all the multiples of 3 or 5 below 1000.附MATLAB代码:clear all
clc
s=0;
for i=1:999
if (rem(i,3)==0)||(rem(i,5)==0)
s=s+i;
end
end
disp(s)最终答案为:233168
Problem1:If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.Find the sum of all the multiples of 3 or 5 below 1000.附MATLAB代码:clear all
clc
s=0;
for i=1:999
if (rem(i,3)==0)||(rem(i,5)==0)
s=s+i;
end
end
disp(s)最终答案为:233168
相关文章推荐
- 欧拉计划第1题
- mysql主从服务器同步心得体会第1/2页
- SIP简介,第1部分:SIP初探
- 比较详细的javascript DOM 学习笔记第1/2页
- 非常不错的[JS]Cookie精通之路第1/2页
- 不错的JavaScript面向对象的简单入门介绍第1/2页
- Javascript入门学习第四篇 js对象和数组第1/2页
- Asp.Net 通用数据操作类 (附通用数据基类)第1/2页
- 功能不错的asp模板类代码附下载第1/4页
- asp.net SAF 中缓存服务的实现第1/5页
- php-5.2下php.ini 中文版配置说明第1/3页
- 网页绿色系配色应用实例图文第1/2页
- css样式之区分input是按钮还是文本框的方法第1/4页
- php让图片可以下载的代码第1/2页
- div+CSS网页布局的意义与副作用原因小结第1/2页
- PostgreSQL8.3.3安装方法第1/2页
- 使用rsync同步网路备份第1/2页
- mssql数据同步实现数据复制的步骤第1/2页
- ajax实时任务提示功能的实现代码第1/2页
- 一个jquery的弹出层的插件第1/2页