GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — java_netbeans/ArrayDemo/ArraayDemo03.java at master · bappasahabapi/java_netbeans Expand file tree/ Copy pathArraayDemo03.javaMore file actions 59 lines (38 loc) · 1.47 KB / Copy pathArraayDemo03.javaFile metadata and controls59 lines (38 loc) · 1.47 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 package arraydemo; import java.util.Scanner; public class ArraayDemo03 //maximum minimum { public static void main(String[] args) { Scanner input = new Scanner(System.in); double[] number =new double[5]; double sum =0; System.out.print("please enter 5 numbers : "); for (int i = 0; i < number.length; i++) { number[i]=input.nextDouble(); } for (int i = 0; i <number.length; i++) { sum =sum+number[i]; } System.out.println("The avarage is : "+sum/number.length ); //avarage double avag =sum/number.length; System.out.println("The sum is : "+sum); System.out.println("Avarage is : "+avag); //alternative way double max =number[0]; // index[0] k amra maximum dorci. double min = number[0]; for (int i = 1; i < 5; i++) { if (max<number[i]) { max =number[i]; } if (min>number[i]) { min =number[i]; } } System.out.println("maximum = "+max); System.out.println("minimum = "+min); } } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |