Write a program that asks the user to input an integer, n, and finds and print the largest number divisible by n that is made from the product of two 3-‐‐digit numbers.
1
Expert's answer
2016-02-16T03:04:53-0500
public static void main(String[] args){ Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int res = 0; for(int i = 0; i<1000000; i++){ if(i%n==0){ for(int j = 100; j<1000; j++){ if(i%j == 0 && ((i/j)>=100 && (i/j)<1000)){ res = i; } } } } System.out.println(res); }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment