WAP to input 5 real number and print only those numbers which are less than its average
Answers
Answered by
7
import java.util.*;
class avg
{
void main()
{
Scanner sc= new Scanner(System.in);
int a= sc.nextInt();
int b= sc.nextInt();
int c= sc.nextInt();
int d= sc.nextInt();
int e= sc.nextInt();
int avg;
avg= (a+b+c+d+e)/5;
if(a< avg)
System.out.println(a);
if(b< avg)
System.out.println(b);
if(c< avg)
System.out.println(c);
if(d< avg)
System.out.println(d);
if(e< avg)
System.out.println(e);
}
}
Similar questions