(在线等待)家庭作业!一个超简单的问题.可是我...再不帮我就笨死了! 家庭作业:求0-200以内所有能被7整除但不能被4整除.按每行6个打印.我在做作业时.发现按每行六个打印就肯定不能用println了,要用print.每个数字间要空格或者用别的符号分开吧.我却不会输出空格,也不会输出其他符号.请各位朋友帮忙.还有能帮我想下怎样才能每行6个打印吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 for(int i = 7, j = 0; i < 200; ++i) { if(i % 7 == 0 && i % 4 != 0) { ++j; System.out.print(i); if(j % 6 == 0) System.out.print('\n'); else System.out.print(' '); }} 我喜欢这样写:int count = 0;for(int i = 7; i <= 200; i += 7){ if(int i % 4 != 0) System.out.printf("%-4d",i); if(++count % 6 == 0) System.out.println();} 郁闷……写少了一句话int count = 0;for(int i = 7; i <= 200; i += 7){ if(int i % 4 != 0) System.out.printf("%-4d",i); else continue; if(++count % 6 == 0) System.out.println();} 求解关于数组问题 JAVA是从什么语言衍伸过来的() <html:submit value="注册"/>为什么不对呀 tomcat链接池自动提交的问题? 大家好,帮忙看看我的这个问题,一个关于字符串转日期的类. 如何捕捉error???? 关于jini编程的一个问题,请指教,谢谢 初学java,不知哪有可视化组件下载?(重分酬谢,立即给分) 问一个很菜的问题,jbuilder里的按钮等控件放在窗体里怎么总是很大,没法调整? jre为什么不需要设置classpath? 求助(我用java Swing写的程序出现问题) 问个线程问题
if(i % 7 == 0 && i % 4 != 0) {
++j;
System.out.print(i);
if(j % 6 == 0) System.out.print('\n');
else System.out.print(' ');
}
}
int count = 0;
for(int i = 7; i <= 200; i += 7){
if(int i % 4 != 0)
System.out.printf("%-4d",i);
if(++count % 6 == 0)
System.out.println();
}
写少了一句话
int count = 0;
for(int i = 7; i <= 200; i += 7){
if(int i % 4 != 0)
System.out.printf("%-4d",i);
else
continue;
if(++count % 6 == 0)
System.out.println();
}