hi been doing this program and keep getting this error.
all it is saying display factor at 38 and 72
any help would be appreciated
public static int getLargest(int num[])
{
int i, largest=0;
for(i=1; i<5; i++)
{
if(i==0)
{
largest = num[i];
}
else if(num[i]> largest)
{
largest = num[i];
}
}
return largest;
}
public static void displayFactors(int num[])
{
int i, n;
for(i=0; i<=5; i++)
{
System.out.println("factors of "+num[i]);
}
System.out.println("");
for(n=1; n<=num[i]; n++) ( the problem is there. dont know if it is an array outofboundexception error.
{
if(num[i]%n == 0)
{
System.out.println(n);
}
}
}
public static void reversed(int num[])
{
int i;
System.out.println("\n numbers in reserved orders");
for(i=5; i>=0; i--)
{
System.out.println(num[i]);
}
}
public static void main(String[] args)
{
Scanner userinput = new Scanner(System.in);
int num[] = new int[6];
int i;
for(i=1; i<=5 ; i++)
{
System.out.println("the largest number is "+getLargest(num));
}
displayFactors(num); (the problem is here also.
reversed(num);
}

