Scanner wont work | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Scanner wont work

import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scan=new Scanner(System.in); int store=0; System.out.println("This program finds the largest length length of " +"a square.Type a number"); System.out.println("Area of square:"); int areaofsquare=scan.nextInt(); for(int factors=1;factors<=areaofsquare;factors++){ if(factors<= areaofsquare % factors ) store=factors; } don't have space

16th Mar 2018, 3:11 AM
Leon Yang
Leon Yang - avatar
3 Answers
16th Mar 2018, 3:18 AM
John Wells
John Wells - avatar
+ 4
You should type the full code by skipping some obvious statements. Because the problem may be after this.
25th Apr 2018, 8:18 PM
Mayank Rampuriya
Mayank Rampuriya - avatar
+ 3
The if test is wrong so it isn't ever true. I believe he meant: if(factors<= areaofsquare / factors ){
16th Mar 2018, 3:20 AM
John Wells
John Wells - avatar