import java.util.Scanner;

class M6                                   //Main Method
{
public static void main(String args[])     //Index of Largest Number method

{
int a[];
int i;
a= new int[10];
System.out.print("Enter any 10 numbers:");
Scanner s = new Scanner(System.in);
a[0]=s.nextInt();
a[1]=s.nextInt();
a[2]=s.nextInt();
a[3]=s.nextInt();
a[4]=s.nextInt();
a[5]=s.nextInt();
a[6]=s.nextInt();
a[7]=s.nextInt();
a[8]=s.nextInt();
a[9]=s.nextInt();

System.out.println("The 10 no.'s you have entered are: ");
for(i=0;i<10;i++)
{
System.out.print("  "+a[i]);
}

double b=a[0];

for(i=0;i<10;i++)
{
	if(a[i]>b)
	{
	 b=a[i];
	}
}
System.out.println("The greatest amoung 10 is "+a[i]);
}

}

this is the program i made plz tell me where i m wrong.....

What is the problem? Do you get errors?
Is the output wrong?

Please post the output to show what is wrong.

What is the purpose of the variable b?

import java.util.Scanner;

class M6{
	public static void main(String args[]){

		int[] a = new int[10];
		Scanner s = new Scanner(System.in);

		for(int i=0;i<10;i++){
			System.out.print("Enter a["+i+"]: ");
			a[i] = s.nextInt();
		}

		System.out.println("Here it is your array: ");
		for(int i=0;i<10;i++)
			System.out.print("a["+i+"]: " + a[i] + "\n");
		
		int max = a[0];
		for(int i=1;i<10;i++)
			if(a[i] > max)
				max = a[i];

		System.out.println("The Maximum Value of array is " + max);
	}

}
commented: Completing homework for others is not acceptable. -3

Hope this can help you...

commented: Too much spoon feeding -3

Posting complete homework solutions is discouraged here. We are here to help people solve their own problems and learn. We are not a homework completion service.

Sorry... I didn't mean to solve the problem, though i just wanted to share idea.

Sharing ideas is good, but try to use examples, hints or explanations to guide them to the solution rather than writing the exact code for them.

don't it have any chances for me to make it right?

You are able to edit posts within 30 minutes of submitting them, if that is what you are asking.

There is an "Edit" button next to the post.

It should be a big deal for me. To tell the truth, i'm just dunno how to explain or hint to people. so what should i do next?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.