【Java例题】3.1 7、11、13的倍数
2024-09-02 22:51:53
1.找出1~5000范围内分别满足如下条件的数: (1) 7或11或13的倍数 (2) 7、11,或7、13或11、13的倍数 (3) 7、11和13的倍数。
package chapter3; public class demo1 {
public static void main(String[] args) {
for(int i=1;i<=5000;i++) {
if(i%7==0||i%11==0||i%13==0) {
System.out.print(i+" ");
if(i%100==0) {
System.out.println();
}
}
}
System.out.println();
System.out.println();
System.out.println();
for(int i=1;i<=5000;i++) {
if((i%7==0&&i%11==0)||(i%7==0&&i%13==0)||(i%11==0&&i%13==0)) {
System.out.print(i+" ");
}
}
System.out.println();
System.out.println();
System.out.println();
for(int i=1;i<=5000;i++) {
if(i%7==0&&i%11==0&&i%13==0) {
System.out.print(i+" ");
}
}
}
}
最新文章
- PL/SQL循环
- 第3月30天 UIImage imageWithContentsOfFile卡顿 Can&#39;t add self as subview MPMoviePlayerControlle rcrash
- ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn&#39;t supported yet
- Java关键字——static
- poj邮局1160
- spring 代码中获取ApplicationContext(@AutoWired,ApplicationListener)
- The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
- 使用cobbler工具实现centos 6,7系统的自动化安装
- 第八节 JS运动基础
- 利用dockerfile定制镜像
- Spring cloud info信息显示
- Java 中的 static 使用
- 8.3Solr API使用(StatsComponent聚合统计)
- 【面向对象】----【prototype&;&;__proto__&;&;实例化对象三者之间的关系】(四)-----【巷子】
- js执行环境的周边概念
- 【UVA10079 训练指南】收集者的难题【最大流】
- MATLAB入门学习(整合)
- MapReduce计算每年最大值
- Verilog 参数化设计
- XMU 1615 刘备闯三国之三顾茅庐(三) 【欧拉函数+快速幂+欧拉定理】
热门文章
- Coderforces 633D:Fibonacci-ish(map+暴力枚举)
- 1、Java简介
- wcf服务编程(一)
- git rebase VS git merge? 更优雅的 git 合并方式值得拥有
- python对Excel的读取
- TensorFlow高效读取数据的方法——TFRecord的学习
- 【Gym - 100923A】Por Costel and Azerah(思维水题)
- Visual Studio 2015 WinForm应用程序打包教程
- 我造了个好大的";轮子";,居然还不是";圆";的!
- 做dede网站知识点总结(捷斯网站)