Write a program in JAVA to INPUT five numbers, calculate the SUM and AVERAGE of the numbers and PRINT the result along with the appropriate messages
Answers
Answered by
7
Answer:
{
public static void main(String arg[ ])
{
int n=5,avg=0;
int a[]=new int[n];
a[0]=10;
a[1]=20;
a[2]=30;
a[3]=40;
a[4]=50;
for(int i=0;i<n;i++)
avg=avg+a[i];
System.out.println("average of ("+a[0]+","+a[1]+","+a[2]+","+a[3]+","+a[4]+") is ="+ avg/n);
}
}
Explanation:
Hope it helps uh......
Plz mark as a brainliest answer...
Similar questions
English,
4 months ago
Computer Science,
4 months ago
Social Sciences,
4 months ago
Physics,
9 months ago
English,
1 year ago