0

hi

I have been trying to build this array program but the result is hurrendous dont know where i have gone.

here is the codes. it is

```
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 problems is here also
{
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 error is here
reversed(num);
}
```