+ 8
Why is the error so?? Can someone help mee please...
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
+ 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);
}
}
+ 5
That was a silly mistake...
Thank you đđđ