Computer Science, asked by sakshidangwal3919, 7 months ago

Write Program for the average of 5 numbers entered by user at run time.

Answers

Answered by RuwaisnZaid
0

Explanation:

n = 5

for i in range(5):

x = int(input("enters. no"))

sum = sum+x

avg = sum/n

print("avg",avg)

plz marke as brainly

Answered by anindyaadhikari13
1

Question:-

  • Write a program for the average of 5 numbers entered by the user at run time.

Code:-

Here is your code written in Java Language.

import java.util.*;

class Average

{

public static void main(String args[])

{

Scanner sc=new Scanner(System.in);

System.out.println("Enter 5 numbers. ");

int s=0;

for(int i=1;i<=5;i++)

s+=sc.nextInt();

double avg=s/5.0;

System.out.println("Average: "+avg);

}

}

Similar questions