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.

题目大意:

10以下的自然数中,属于3和5的倍数的有3,5,6和9,它们之和是23.

找出1000以下的自然数中,属于3和5的倍数的数字之和。

#include <stdio.h>
#include <string.h>
#include <ctype.h> void solve()
{
int sum,i;
sum=;
for(i=; i<; i++)
{
if(i%== || i%==)
{
sum+=i;
}
}
printf("%d\n",sum); } int main()
{
solve();
return ;
}

(Problem 1)Multiples of 3 and 5的更多相关文章

  1. (Problem 73)Counting fractions in a range

    Consider the fraction, n/d, where n and d are positive integers. If nd and HCF(n,d)=1, it is called ...

  2. (Problem 42)Coded triangle numbers

    The nth term of the sequence of triangle numbers is given by, tn = ½n(n+1); so the first ten triangl ...

  3. (Problem 41)Pandigital prime

    We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly o ...

  4. (Problem 70)Totient permutation

    Euler's Totient function, φ(n) [sometimes called the phi function], is used to determine the number ...

  5. (Problem 74)Digit factorial chains

    The number 145 is well known for the property that the sum of the factorial of its digits is equal t ...

  6. (Problem 46)Goldbach's other conjecture

    It was proposed by Christian Goldbach that every odd composite number can be written as the sum of a ...

  7. (Problem 72)Counting fractions

    Consider the fraction, n/d, where n and d are positive integers. If nd and HCF(n,d)=1, it is called ...

  8. (Problem 53)Combinatoric selections

    There are exactly ten ways of selecting three from five, 12345: 123, 124, 125, 134, 135, 145, 234, 2 ...

  9. (Problem 49)Prime permutations

    The arithmetic sequence, 1487, 4817, 8147, in which each of the terms increases by 3330, is unusual ...

随机推荐

  1. 0527 python 基础01

    折行的处理 \>>> print "hi \... hello Lucy!"hi hello Lucy! 自然字符串,字符串加上r或R前缀指定>>&g ...

  2. 删除Mac中所有 .DS_Store 隐藏文件

    删除Mac中所有 .DS_Store 隐藏文件 35•36509感谢 longago 分享于 2012-07-06 12:01|只看该作者|倒序浏览|打印 Safari 5.1.7 Mac OS X ...

  3. 基于SIM 卡卡基不同制作工艺的研究

    1 国内外现行的SIM 卡卡基制作工艺 SIM 卡由卡基和芯片两部分组成.卡基上有植入芯片的台阶式芯片槽,SIM 卡的芯片通过多点焊接植入台阶式芯片槽之中与卡基组成SIM 卡,然后经过个性化数据处理, ...

  4. php如何在原来的时间上加一天?一小时

    php如何在原来的时间上加一天?一小时? <?phpecho "今天:",date('Y-m-d H:i:s'),"<br>";echo &q ...

  5. Oracle 日期计算

    日期相减,求天数 方法一: )),createdate from goods t

  6. Filter 知识总结

    Filter对web服务器管理的所有web资源:例如Jsp, Servlet, 静态图片文件或静态 html 文件等进行拦截,从而实现一些特殊的功能.例如实现URL级别的权限访问控制.过滤敏感词汇.压 ...

  7. Sicily-1050 深度优先搜索

    一.      题意 给出5个数和4则运算,看能不能算出目标值出来,如果算不出来就算出比目标值小的最大值.深搜:每一步选两个数做运算,然后算出的结果作为下一步的其中一个操作数.每一步选数有C(5,2) ...

  8. XCL-Charts图表库中柱形图的同源风格切换介绍

    柱形图是被使用最多的图之中的一个,在写XCL-Charts这个Android图表库时,为它花费的时间相当多,不是由于有多难绘制,而是要在设计时怎样才干保证图基类能适应各种情况,能灵活满足足够多的需求, ...

  9. hdu 3966 Aragorn&#39;s Story(树链剖分+树状数组)

    pid=3966" target="_blank" style="">题目链接:hdu 3966 Aragorn's Story 题目大意:给定 ...

  10. VCS引起的oracle数据库异常重新启动一例

    1. 环境描写叙述 操作系统版本号:SUSE Linux Enterprise Server 10 sp2 (x86_64) 数据库版本号:Oracle 11.1.0.7.16 VCS版本号:5.1 ...