For each element of a set of arrays and *

Source: Internet
Author: User

Package com.chongrui.test;

/*
* Ask for a set of elements of the array and *
* */

Import Java.util.Scanner;
public class Test {

public static void Main (string[] args) {
int[] num = {18,12,344,4,5,6,7,8,9,10};//Creates and initializes a one-dimensional array of num

SYSTEM.OUT.PRINTLN ("Output one-dimensional array");
for (int i=0;i<num.length;i++) {//num.lenght conditional statement

System.out.println (num[i]+ "");//Data element subscript etc 9, output equals sign

int min = num[0];
for (int j=0;j<num.length-1;j++) {//Iterate through the array with a For loop
if (Min>num[j+1]) {
MIN=NUM[J+1];


}

}
System.out.println ("Smallest of array elements" +min);
}




}
}

Output one-dimensional arrays
18
Minimum 4 of array elements
12
Minimum 4 of array elements
344
Minimum 4 of array elements
4
Minimum 4 of array elements
5
Minimum 4 of array elements
6
Minimum 4 of array elements
7
Minimum 4 of array elements
8
Minimum 4 of array elements
9
Minimum 4 of array elements
10
Minimum 4 of array elements

For each element of a set of arrays and *

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.