array = (1..10).to_a # 方法1 length = array.length length.times do |t| print "#{array[t]} " end puts "\n" # 方法2 length = array.length-1 for i in 0..length do print "#{array[i]} " end puts "\n" # 方法3 for i in array do…
总结:输出最大值,最小值,可以先排序,再输出就容易点了.不用循环判断.我还没学.但是觉得很好用 package com.aini; import java.util.Arrays; import java.util.Scanner; //求把数组里的元素,输出最大值,最小值,平均值 public class PAI { public static void main(String[] args) { Scanner c = new Scanner(System.in); System.out.p…
示例 var scores = [24, 32, 17]; // A数组 var arrayLength = scores.length;// 数组的长度 //当i<arrayLength时,可以按顺序访问数组中的值 for (var i = 0; i < arrayLength; i++) { var B=scores[i];//调用数组中的值 println(B) } function println(a) { document.write(a+"<br>"…
var scores = [24, 32, 17]; var arrayLength = scores.length; var i =0; while(i < arrayLength){ var B=scores[i]; println(B); i++; } function println(a) { document.write(a+"<br>") }…