11 comments:

  1. import java.util.Scanner;

    class Test1{
    public static void main(String a[]){
    int ar[]=new int[100];
    int i,number,sum=0;
    double avg;
    System.out.print("Enter the number of elements: ");
    Scanner o=new Scanner(System.in);
    number=o.nextInt();
    System.out.println("Now enter the values of array: ");
    for(i=0;i<number;i++){
    ar[i]=o.nextInt();
    sum+=ar[i];
    }
    avg=(double)sum/number;
    System.out.println("The numbers above average are: ");

    for(i=0;i<number;i++){
    if(avg<ar[i])
    System.out.print("\t"+ar[i]);
    }

    }
    }


    OUTPUT
    Enter the number of elements: 5
    Now enter the values of array:
    12 78 56 23 45
    The numbers above average are:
    78 56 45

    ReplyDelete
  2. import java.util.Scanner;
    class AboveAvg
    {
    public static void main(String args[])
    {
    int Average,sum=0;
    Scanner scan=new Scanner(System.in);
    System.out.println("How many number you want to add");
    int n=scan.nextInt();
    int ar[]=new int[n];
    System.out.println("Enter Numbers");
    for (int i=0;i<n;i++)
    {
    ar[i]=scan.nextInt();
    sum+=ar[i];
    }
    Average=sum/n;
    System.out.println("Average "+Average);
    System.out.println("Numbers Are:-");
    for (int i=0;i<n;i++)
    {
    if(Average<ar[i]){
    System.out.print(ar[i]+" ");}
    }
    }
    }

    ReplyDelete
  3. import java.util.Scanner;
    class A
    {
    public static void main(String args[]);
    {
    Scanner obj=new Scanner(System.in);
    int n,avg;
    int sum=0;
    System.out.println("Enter the value of n");
    n=obj.nextInt();
    int arr[]=new int[n];
    System.out.println("Enter the array");
    for(i=0;i<n;i++)
    {
    arr[i]=obj.nextInt();
    sum=sum+arr[i];
    }
    avg=sum/n;
    System.out.println("The average is="+avg);
    System.out.println("The values greater than average are=");
    for(i=0;i<n;i++)
    {
    if(arr[i]>avg)
    {
    System.out.println(arr[i]);
    }
    }
    }
    }

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. import java.util.Scanner;
    class Average
    {
    public static void main(String Args[])
    {
    System.out.println("How many numbers you want to enter?");
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int Ar[]=new int[n];
    int sum=0,i;
    float avg;
    System.out.println("enter the values");
    for(i=0;iavg)
    System.out.println(Ar[i]+"");
    }}
    }

    ReplyDelete
  8. import java.util.Scanner;
    class Print{
    public static void main(String ar[])
    {
    Scanner obj=new Scanner(System.in);
    int n,i,sum=0;
    float avg;
    System.out.println("enter the value of n");
    n=obj.nextInt();
    int arr[]=new int[n];
    for(i=0;i<n;i++){
    System.out.println("enter the element "+i);
    arr[i]=obj.nextInt();
    sum+=arr[i];
    }
    avg=sum/n;
    System.out.println("the average is"+avg);
    for(i=0;i<n;i++)
    {
    if(avg<arr[i])
    System.out.println(arr[i]);

    }
    System.out.println("the above elements are greater than average");
    }
    }

    ReplyDelete
  9. import java.util.Scanner;
    class Average{
    public static void main(String args[]){
    int size,i=0;
    int avg=0,sum=0;
    Scanner scan=new Scanner(System.in);
    System.out.println("enter the size of array");
    size=scan.nextInt();
    int ar[]=new int[size];
    for(i=0;i<size;i++){
    System.out.println("enter the value"+(i+1));
    ar[i]=scan.nextInt();
    }
    System.out.println("Array :");
    for(i=0;i<size;i++){
    System.out.println(ar[i]+" ");
    sum=sum+ar[i];
    avg=sum/size;}
    System.out.println("average:"+avg);

    for(i=0;i<size;i++){
    if(avg<ar[i])
    System.out.println("Elements above average:"+ar[i]);}
    }
    }




    ReplyDelete
  10. import java.util.Scanner;
    class Average{
    public static void main(String a[]){
    int n,sum=0;
    int average=0;
    Scanner scan=new Scanner(System.in);
    System.out.println("Enter the size of the array:");
    n=scan.nextInt();
    int ar[]=new int[n];
    System.out.println("Enter the values of array:");
    for(int i=0;i<n;i++){
    ar[i]=scan.nextInt();
    sum=sum+ar[i];
    }
    average=sum/n;
    for(int i=0;i<n;i++){
    if(average<ar[i]){
    System.out.println("The values above average are:"+ar[i]);
    }
    }
    }
    }

    ReplyDelete
  11. import java.util.*;

    class Array3{
    public static void main(String ar[]){
    Scanner s=new Scanner(System.in);
    int i,n,sum=0;
    double avg;
    System.out.print("Enter the number of values: ");
    n=s.nextInt();
    int a[]=new int[n];
    System.out.println("enter the values: ");
    for(i=0;i<n;i++){
    a[i]=s.nextInt();
    sum+=a[i];
    }
    avg=sum/n;
    System.out.println("average:"+avg);

    System.out.println("numbers above average: ");

    for(i=0;i<n;i++){
    if(avg<a[i])
    System.out.print(" "+a[i]);
    }

    }
    }

    ReplyDelete