using java write a program to input any 10 integers and print the largest and second largest number in the given set of integers assume no duplicate no in the set of the number pls help only serious solution
Answers
Answered by
1
Answer:
MARK ME AS BRAINLIEST
Explanation:
import java.util.Scanner;
class program{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n =sc.nextInt();
int a[]=new int[n];
for(int i=0;i<n;i++){
a[i]=sc.nextInt();
}
int max1=a[0],max2=a[0];
for(int j=0;j<n;j++){
if(a[j]>max1){
max1=a[j];
}
}
for(int k=0;k<n;k++){
if(a[k]>max2 && max1>a[k]){
max2=a[k];
}
}
System.out.println(max1+" "+max2);
}
}
Answered by
0
Answer:
lol ..
do it yourself .
don't be dependent on someone
Similar questions