Computer Science, asked by palaskainthebuilding, 5 months ago

write a program of input three numbers and display their average

Answers

Answered by valeriy69
2

\small\mathsf\color{pink}{Solution\: using\: python\: 3}

nums = [int(x) for x in input("enter 3 nums: ").split()]

print(f"average: {sum(nums) / len(nums)}")

\small\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Answered by Shivu516
0

This program is in Java.  

import java.util.*;

public class AverageCalculator {

   public static void main (String [] args) {

       //Taking input from the user

       Scanner sc = new Scanner(System.in);

       System.out.print("Enter the first number: ");

       double num1 = sc.nextDouble();

       System.out.print("Enter the second number: ");

       double num2 = sc.nextDouble();

       System.out.print("Enter the third number: ");

       double num3 = sc.nextDouble();

       //Main part comes here

       double Average = (num1 + num2 + num3) / 3;

       System.out.println("The average of the given numbers is " + Average);

   }

}

Output:

Enter the first number: 30

Enter the second number: 31

Enter the third number: 28

The average of the given numbers is 29.666666666666668

Similar questions