wap to java find the average 20 even number. by using scanner class
Answers
Answered by
1
Answer:
2000
Explanation:
Answered by
0
Answer:
java.util.Scanner;
class Average
{
public static void main(String arg[])
{
int n;double res=0;
Scanner sc=new Scanner(System.in);
System.out.println("enter how many numbers to cal avg");
n=sc.nextInt();
int a[]=new int[n];
System.out.println("enter "+n+" numbers");
for(int i=0;i<n;i++)
a[i]=sc.nextInt();
for(int i=0;i<n;i++)
res =res+a[i];
System.out.println("average="+res/n);
}
}
Similar questions