Hi Anusha,
I am not sure about the outcome of the program, do you want the program to compare each element with every other element and print the highest value?
I have made few changes and below program compares the first element iwth every other element and prints the result and then it will compare second element with every other element and so on:
class Higher {
public static void main(String[] args) {
int m[]={10,60,20,50,80,40,90,70,30,100};
for(int i=0;i<9;i++ ){
for(int j=1;j<10;j++ ){
if(m[i] > m[j])
System.out.println("Number with higher value is" +m[i]);
else
System.out.println("Number with higher value is" +m[j]);
}
}
}
}
Aug 17, 2010