Computer Science, asked by rinareenasharma123, 3 months ago

enter 10 numbers and find average with last digit 2 and 4​


himanshu2006vps: In which programming language should I write
himanshu2006vps: can I write in java
rinareenasharma123: now no need my exam has been over
himanshu2006vps: ok I will write in some other languages
himanshu2006vps: and get some point

Answers

Answered by himanshu2006vps
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