博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Java语言程序设计(基础篇)第十版 5.10-11
阅读量:3916 次
发布时间:2019-05-23

本文共 709 字,大约阅读时间需要 2 分钟。

public class j5_10 {	public static void main(String[] args) {		// TODO Auto-generated method stub		int counter = 0;		for(int i = 100;i<=1000;i++)		{			if(i %5 == 0 && i %6 == 0)			{				System.out.printf("%4d",i);				counter ++;			}					if(counter %10==0 && counter >1)			{				System.out.printf("\n");				counter = 0;			}		}	}}
public class J5_11 {	public static void main(String[] args) {		// TODO Auto-generated method stub		int counter = 0;		for(int i = 100;i<=200;i++)		{			if(i %5 == 0 && i %6 == 0)			{				continue;			}			else if(i % 5 ==0 || i % 6 ==0)			{				System.out.printf("%4d",i);				counter ++;			}						if(counter %10==0 && counter >1)			{				System.out.printf("\n");				counter = 0;			}		}	}	}

转载地址:http://bubrn.baihongyu.com/

你可能感兴趣的文章
SpringBoot基础篇Bean之条件注入@Condition使用姿势
查看>>
让你秒懂线程和线程安全,只需5步!
查看>>
Spring Boot学习之Logback和Log4j2集成与日志发展史
查看>>
Java注解(annotation)机制
查看>>
volatile关键字全面解析
查看>>
Java如何实现哈夫曼编码
查看>>
从源代码的角度理解Java设计模式的装饰模式
查看>>
系统架构中为什么要引入消息中间件?
查看>>
Java内存模型详解
查看>>
Java NIO之Selector
查看>>
SLF4J源码解析(一)
查看>>
Spring AOP用法详解
查看>>
记一位朋友斩获BAT技术专家Offer的面试经历
查看>>
Java并发编程之阻塞队列与Fork/Join框架
查看>>
并发、并行傻傻分不清楚?
查看>>
一个Java程序员该有的良好品质
查看>>
程序员创业之如何获取第一笔风险投资
查看>>
听说小米进入世界500强啦?解读历年500强数据了解国情
查看>>
Maven中央仓库发布历程
查看>>
springBoot的过滤器,监听器,拦截器
查看>>