0% found this document useful (0 votes)
47 views1 page

6.WAPT Find The Max and Min Number in An Array: INPUT: (1,2,3,4,5,6,7,8,9,10) OUTPUT

The document provides code to find the maximum and minimum numbers in an array. It defines a class with methods to accept an array of 10 integers as input, then iterate through the array to track and update the running maximum and minimum values. It prints the final maximum and minimum values found in the array.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views1 page

6.WAPT Find The Max and Min Number in An Array: INPUT: (1,2,3,4,5,6,7,8,9,10) OUTPUT

The document provides code to find the maximum and minimum numbers in an array. It defines a class with methods to accept an array of 10 integers as input, then iterate through the array to track and update the running maximum and minimum values. It prints the final maximum and minimum values found in the array.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

KARTIK V / 11A / 11122

6.WAPT find the max and min number in an array


class arraymaxmin { int num[]=new int[10]; int temp; public void accept(int arr[]) //Enter only 10 valid integer numbers { for(int i=0;i<10;i++) { num[i]=arr[i]; }} public void checkers() { int max=num[0],min=num[0]; for(int i=0;i<10;i++) { if(num[i]>max) { max=num[i]; } if(min>num[i]) { min=num[i]; }} System.out.println("MAX="+max+" "+"MIN="+min); }} INPUT : {1,2,3,4,5,6,7,8,9,10}; OUTPUT :

KARTIK V / 11A / 11122

You might also like