把100~200计之间的不能被3和7整数的数输出,网页制作for循环做?

如题所述

输出100~200之间的不能被3整除的数。

解:程序:

#include<stdio.h>

int main()

{

int i=0;

printf("打印出不能被3整除的数:");

for (i = 100; i <= 200; i++)

{

if (i%3 == 0)

{

continue;

}

printf("%d ",i);

}

printf("\n");

return 0;

}

结果:

打印出不能被3整除的数:100 101 103 104 106 107 109 110 112 113 115 116 118 119 121 122 124 125 127 128 130 131 133 134 136 137 139 140 142 143 145 146 148 149 151 152 154 155 157 158 160 161 163 164 166 167 169 170 172 173 175 176 178 179 181 182 184 185 187 188 190 191 193 194 196 197 199 200

请按任意键继续. . .
————————————————
版权声明:本文为CSDN博主「岩枭」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/yanxiaolx/article/details/51531665
温馨提示:答案为网友推荐,仅供参考
第1个回答  2019-10-24
用js写?
print_Num : function(){
var num = [];
for (var i=100;i<=200;i++){
if(i%3 != 0 && i%7 != 0){
num.push(i);
}
}
$.each(num,function(i,number){
//随便你自己拿这个数组干嘛
})
},
第2个回答  2019-10-24
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
.re{
background: red;
width: 16%;
}
.gr{
background: green;
width: 16%;
}
li{
list-style: none;
color: white;

}
</style>
</head>
<body>

</body>
<script>
var a=100;
for (a;a<=200;a++) {
if(a%3!=0&&a%7!=0){
document.writeln("<li class='re'>"+a+"不能被3和7整除!!!!!</li><br/>")
}else{
document.writeln("<li class='gr'>"+a+"可以被整除了.....................</li><br/>")
}
}

</script>
</html>
有帮助别忘记采纳哦追问

java定义一个小写字母,并将其转化为大写字母后,再输出..

相似回答