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. python的虚拟运行环境

    Python 虚拟环境:Virtualenv 博客分类: Python python 在进行python开发的时候避免不同版本python或python不同版本组件之间的冲突, 有必要配置python ...

  2. 整理网站优化(SEO)的方案

    首先,我们来确定一下seo方案的定义是什么,所谓seo方案是指针对于某个网站,在完成了解熟悉的情况下,结合自身的一套seo优化方法来制定完成符合这个网站seo推广思路和策略.接下来就了解一下新手seo ...

  3. Aone新拉分支

    1.进入Aone新建项目 2.测试人员填huyangjun和husong 3.进入后拉分支 4.弄个日常普通环境 5.吧环境跑起,绑定Host就可以

  4. rhApp遇到的项目问题

    1.如果有多人同时操作一个桌台的情况下,如何处理: 2.index页面点击清空的时候是否要把桌台一起清掉: 3.账单界面已结账的小单背景色是否需要和未结账的不同:

  5. 贫血模型or领域模型

    参考: http://lifethinker.iteye.com/blog/283668 http://www.uml.org.cn/mxdx/200907132.asp http://www.itu ...

  6. Poj 2371 Questions and answers(排序)

    题目链接:http://poj.org/problem?id=2371 思路分析:使用计数排序或其他时间复杂度为O( log N )的排序. 代码如下: #include <iostream&g ...

  7. Ubuntu 12.10 安装JDK7

    1.首先到oracle下载上下载jdk-7u25-linux-i586.tar.gz 2.将jdk-7u25-linux-i586.tar.gz复制到/usr/lib/jvm/目录以下,这里假设没有j ...

  8. adb shell top

    PID:进程在系统中的ID CPU% - 当前瞬时所以使用CPU占用率 #THR - 程序当前所用的线程数 UID - 运行当前进程的用户id Name - 程序名称android.process.m ...

  9. mysql待整理

    1. MYSQL SQL_NO_CACHE的真正含义 http://www.dewen.org/q/5149/Mysql 是 结果不缓存,但查询还是缓存了. 如果要重新测试,就在查询前先执行一下&qu ...

  10. Quiz 6b Question 8————An Introduction to Interactive Programming in Python

     Question 8 We can use loops to simulate natural processes over time. Write a program that calcula ...