+ 8

Why is the error so?? Can someone help mee please...

https://code.sololearn.com/cZIuJ7cY8qVf/?ref=app

21st Sep 2020, 2:46 PM
Rucha
Rucha - avatar
3 Answers
+ 5
Because you didn't add any value to m before the condition .That's why the error occurred m may not be initialized
21st Sep 2020, 2:50 PM
The future is now thanks to science
The future is now thanks to science - avatar
+ 5
You forget to intilize the value of m . import java.util.scanner; public class maxmin { public static void main(string[] args) { scanner in=new scanner(system.in); int a,m=7,n,max=0,min=0; system.out.println("enter the first number"); n=in.nextint(); min=n;max=n; for(a=2;a<=10;a++); { system.out.println("enter the other nine numbers"); if(m<min) min=m; if(m>max) max=m; } system.out.println("greatest number "+max); system.out.println("smallest number"+min); } }
21st Sep 2020, 3:41 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 5
That was a silly mistake... Thank you 😊😊😊
22nd Sep 2020, 4:19 AM
Rucha
Rucha - avatar