Computer Science, asked by KrishnVasudev, 5 months ago

Write a program in Java to input 10 numbers and find their sum and average.​

Answers

Answered by vijayghore
2

Answer:

import java.util.Scanner;

class Sample

{

public static void main(String args[])

{

 Scanner sc = new Scanner(System.in);

 System.out.println("Please enter 10 numberes");

 

 int arr[] = new int[10], sum=0;

 double avg;

 for(int i=0; i<arr.length; i++)  

 {  

  arr[i]=sc.nextInt();

  sum+=arr[i];  

 }  

 avg = sum/10.0;

 System.out.println("Sum is = "+sum+"\n Average is = "+avg);

}

}

Answered by ashiyadav35
1

Explanation:

please follow me

branlist Answer

Attachments:
Similar questions