64 570
Assignments Done
99,2%
Successfully Done
In September 2018

Answer to Question #57820 in Java | JSP | JSF for Nithya

Question #57820
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.
Expert's answer
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);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions