0% found this document useful (0 votes)
20 views4 pages

Import Public Class Public Static Public Static Void New Int New Int Int For

hsjjhushamsjhk. hgs snbsk
Copyright
© © All Rights Reserved
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)
20 views4 pages

Import Public Class Public Static Public Static Void New Int New Int Int For

hsjjhushamsjhk. hgs snbsk
Copyright
© © All Rights Reserved
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/ 4

import java.util.

Scanner;
public class SAFIH {
public static Scanner sc;
public static void main(String[] args) {
sc = new Scanner(System.in);
int []s=new int[10];
System.out.println("Enter The Element:");
int j=0;
for (;j<s.length;j++)
{
System.out.print("S["+(j+1)+"]:");
s[j]=sc.nextInt();
}
//find maximum number
int max = s[0],i=1;
for(;i < s.length;i++)
{ if(s[i] > max){
max = s[i]; }
}
System.out.println("--------------------");
System.out.println("MAXIMUM NUMBER= "+max);
///find minmum number
int min = s[0], k=1;
for(;k<s.length;k++){
if(s[k] < min){
min = s[k];
}
}
System.out.println("--------------------");
System.out.println("MINimum NUMBER= "+min);
//display the array
System.out.println("--------------------");
System.out.println("THE ARRAY VALUE:");
for ( int l=0;l<s.length;l++)
{
System.out.print(" "+s[l]+" ");
}
} }
import java.util.Scanner;
import java.util.Vector;

public class SAFIH_SAEED {

public static Scanner sc;

public static void main(String[] args) {


Vector<Integer> s = new Vector<Integer>(10);
sc = new Scanner(System.in);
int count_number=0;
float total=0;
float avr=0;
System.out.println("PLEASE ENTER ARRAY NUMBER :");
int F=0;
for (;F<10;F++)
{
System.out.print("S["+(F+1)+"]:");
s.add(sc.nextInt());
total=total+s.get(F);
}
//CALCULATE THE AVERAGE
avr=total/10;
System.out.println("--------------------");
System.out.println("THE AVERAGE= " + avr);
System.out.println("--------------------");
for (int i=0;i<10;i++) {
if(s.get(i)>avr)
count_number++;
}
System.out.println("--------------------");
System.out.println("THE NUMBER OF ELEMNT ABOVE THE AVERAGE= "
+ count_number);
System.out.println("--------------------");
}
}

You might also like