Computer Science, asked by ayankumarbiswas94, 15 days ago

Write a program to create an array to store 10 integers and print the largest integer and

the smallest integer in that array.​

Answers

Answered by ananyaubhat231
1

Answer:

class Max min

{

public static void main(String args[ ])

{

Scanner sc=new Scanner(System.in);

int i, min,max;

int m[ ]=new int [10 ]

for(i=0;i<10;i++)

{

System.out.println("enter the array elements");

m[i]=sc.nextInt();

}

max=m[0];

min=m[0];

for(i=0;i<10;i++)

{

if(m[i]>max)

max=m[i];

if(m[i]<min)

min=m[i];

}

System.out.println("the greater element is"+max);

System.out.println("the smallest element is"+min);

}

}

Explanation:

Similar questions