您的位置:首页 > 职场人生

“黑马程序员” 计算1`100之间7的倍数的个数。并打印

2014-06-13 17:06 423 查看
---------------------- <a href="http://www.itheima.com"target="blank">ASP.Net+Unity开发</a>、<a href="http://www.itheima.com"target="blank">.Net培训</a>、期待与您交流!
----------------------

//试题:1`100之间 7的倍数的个数。并打印
package 练习;

public class test2 {

public static void main(String[] args)

{

int y = 0 ;

for(int x = 1;x<=100;x++)

{

if (x%7==0)

{

y++;

System.out.println(x);

x++;

}else

x++;

}

System.out.println("1`100之间 7的倍数的个数有"+y);

}

}

---------------------- <a href="http://www.itheima.com"target="blank">ASP.Net+Unity开发</a>、<a href="http://www.itheima.com"target="blank">.Net培训</a>、期待与您交流!
----------------------
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐