编写一个程序,求出200到300之间的数,且满足条件:它们三个数字之积为42,三个数字之和为12。

 

package com.Demo;

public class test12 {

	public static void main(String[] args) {
		/*
		 * 编写一个程序,求出200到300之间的数 且满足条件:
		 * 它们三个数字之积为42,三个数字之和为12。
		 */
		for (int n = 200; n <= 300; n++) {
			int a = n % 10;
			int b = n / 10 % 10;
			int c = n / 100;
			if (a * b * c == 42 && a + b + c == 12)
				System.out.println(n);
		}
	}

}

 

《编写一个程序,求出200到300之间的数,且满足条件:它们三个数字之积为42,三个数字之和为12。》

    原文作者:我不吃鱼鱼
    原文地址: https://blog.csdn.net/IGGIRing/article/details/88230095
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞