enter 10 numbers and find average with last digit 2 and 4
himanshu2006vps:
In which programming language should I write
Answers
Answered by
1
Explanation:
program to calculate average of N numbersJava
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class Average
{
public static void main(String arg[])
{
int n=5,result=0;
int a[]=new int[5];
a[0]=10;
a[1]=20;
a[2]=30;
a[3]=40;
a[4]=50;
for(int i=0;i<n;i++)
result=result+a[i];
System.out.println("average of ("+a[0]+","+a[1]+","+a[2]+","+a[3]+","+a[4]+") is ="+result/n);
}
}
Similar questions
Math,
1 month ago
Math,
3 months ago
English,
3 months ago
Math,
10 months ago
Psychology,
10 months ago