Write a Java program to find the numbers greater than the average of the numbers of a given array.


 /*Write a Java program to find the numbers greater than the average of the

numbers of a given array.*/

import java.util.*;

class Fourth

{

public static void main(String arg[])

{

Scanner obj=new Scanner(System.in);

int[] arr = new int[5];

int sum = 0, ave;


for(int i=0 ; i<5 ; i++)

{

System.out.print("Enter the number : ");

arr[i] = obj.nextInt();

sum = sum + arr[i];

}

ave = sum / 5;


System.out.println("\nSum of enterd numbers : " + sum );

System.out.println("Average : "+ave);


System.out.println("\nNumbers greater than everage :");

for(int i=0 ; i<5 ; i++)

{

if(arr[i] > ave)

{

System.out.println(" " + arr[i] );

}

}

}

}

More Information on our channel Programmer Community

please like , share and subscribe to get notifications of new videos....

To understand this program video will coming soon on our you tube channel


Comments

Popular posts from this blog

Design and Develop a java program to read marks of a student and print the total and average of marks using scanner class.

Write a Java program to convert seconds to hour, minute and seconds.

Write a Java program to print the ascii value of a given character.