输出100以内不能被5整除的性质数,要求每行输出5个值

君,已阅读到文档的结尾了呢~~
编程输出0~100间所有能被3或5整除的数,每行输出不多于5编程,输出,能够,编程输出,能被3,5整除的数,输出0,输出,每行输出5,输出
扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
编程输出0~100间所有能被3或5整除的数,每行输出不多于5
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='/DocinViewer-4.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口君,已阅读到文档的结尾了呢~~
扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
输出1~100之间不能被7整除的数,输出是没行输出五个,要求设计函数判断某一个数能否被七整除
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='/DocinViewer-4.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口求从10到100中能被3或5整除的数的和(面试题) - 开源中国社区
当前访客身份:游客 [
当前位置:
发布于 日 22时,
求从10到100中能被3或5整除的数的和(面试题)
代码片段(1)
1.&[代码]求从10到100中能被3或5整除的数的和(面试题)&&&&
public class Test {
public static void main(String[] args) {
int sum = 0;
for (int i = 10; i & 100; i++) {
if (i % 3 ==0 || i % 5 == 0) {
System.out.println(sum);
开源中国-程序员在线工具:
相关的代码(3458)
0回/1092阅
int nRemain3, nRemain5, nS
nRemain3 = 3 - 10 % 3;
nRemain5 = 5 - 10 % 5;
nStep = 0;
for(i=10; i&=100; i+= nStep)
printf(&%d &, i);
nRemain3 -= nS
nRemain5 -= nS
while(nRemain3 &= 0)
nRemain3 += 3;
while(nRemain5 &= 0)
nRemain5 += 5;
if(nRemain3 & nRemain5)
nStep = nRemain5;
nStep = nRemain3;
2楼:nqsindy 发表于
public class SumDiv {
public static void main(String[] args) {
int sum = sumFunction();
System.out.println(&sum:& + sum);
public static int sumFunction() {
int sum = 0;
for (int i = 10; i & 100; i++) {
if (i % 3 == 0 && i % 5 == 0) {
sum = sum +
System.out.println(&i:& + i);
3楼:面码 发表于
count tot nums val in 10~100 which 10%3 = 0 or 10%5 = 0
#include &stdio.h&
#define DEBUG 1
int table[120];
#define END&&&& 100
#define BASE3&& 12
#define STEP3&& 3
#define BASE5&& 10
#define STEP5&& 5
int solve(void){
&&& int sum = 0;
&&& int pos3 = BASE3;
&&& int pos5 = BASE5;
&&& while(pos3 & 100){
&&&&&&&&&&& if(pos5 & 100){
&&&&&&&&&&&&&&& table[pos5] = 1;
&&&&&&&&&&&&&&& sum += pos5;
&&&&&&&&&&&&&&& pos5 += STEP5;
&&&&&&&&&&& }
&&&&&&&&&&& if(!table[pos3]){
&&&&&&&&&&&&&&& sum += pos3;
&&&&&&&&&&& }
&&&&&&&&&&& pos3 += STEP3;
int main(void){
&&& printf(&%d\n&, solve());
&&& return 0;
4楼:面码 发表于
&*&@brief&count&tot&nums&val&in&10~100&which&10%3&=&0&or&10%5&=&0
&*&@param&void
&*&@return&tot&nums
#include&&stdio.h&
#define&END&&&&&100
#define&BASE3&&&12
#define&STEP3&&&3
#define&BASE5&&&10
#define&STEP5&&&5
#define&BASE15&&15
#define&STEP15&&15
int&solve(void){
&&&&int&sum&=&0;
&&&&int&pos3&=&BASE3;
&&&&int&pos5&=&BASE5;
&&&&int&pos15&=&BASE15;
&&&&while(pos3&&&100){
&&&&&&&&&&&&sum&+=&pos3;
&&&&&&&&&&&&pos3&+=&STEP3;
&&&&&&&&&&&&if(pos5&&=&&100){
&&&&&&&&&&&&&&&&
&&&&&&&&&&&&}
&&&&&&&&&&&&sum&+=&pos5;
&&&&&&&&&&&&pos5&+=&STEP5;
&&&&&&&&&&&&if(pos15&&=&100){
&&&&&&&&&&&&&&&&
&&&&&&&&&&&&}
&&&&&&&&&&&&sum&-=&pos15;
&&&&&&&&&&&&pos15&+=&STEP15;
&&&&return&
int&main(void){
&&&&printf(&%d\n&,&solve());
&&&&return&0;
开源从代码分享开始
fangley的其它代码从1到100中能被5整除的数,在表格中以每行5个数进行显示,同时输出其和
echo "&table width='500' border='0' cellpadding='0'
cellspacing='1' bgcolor='#228800'
align='center'&&tr&";
for($i=1;$i&=100;$i++)
&if($i%5==0)
&echo "&td bgcolor='#FFFFFF'
align='center'&$i&/td&";
&$sum+=$i;
&&if($j%5==0&&$j&&100)
"&/tr&&tr&";
echo "&td colspan=5 align='center'
bgcolor='#FFFFFF'&总和为$sum&/td&&/tr&&/table&";
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。}

我要回帖

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信