Write a program to input 10 numbers and print the largest number among all the inputted numbers.
Answers
Answered by
10
Answer:
import java.util.*;
class Largest
{
public static void main()
{
Scanner sc=new Scanner(System.in);
int a[]=new int[10];
System.out.println("Enter 10 numbers");
for(int i=0;i<10;i++)
a[i]=sc.nextInt();
int large=a[0];
for(int i=0;i<10;i++)
if(large<a[i])
large=a[i];
System.out.println("Largest number : "+large);
}
}
Answered by
3
hope it will help you.
no need of thanks
Attachments:
Similar questions