Computer Science, asked by trayam123, 7 months ago

Write a program to find the average of three numbers 39,45 and 62.​

Answers

Answered by cvijayalakshmi
1

Answer:

1.# include (stdio.h)

2.#include (conic. h)

3. void main ()

4.int n1, n2, n3;

5.flot avg;

6.printf("/nENTER THREE NUMBERS:");

7.Scanf("%d %d %d " &n1,&n2,&n3);

8.avg = (n1+n2+n3)/3;

Answered by Shivu516
0

This program is in Java. Enter your inputs to get the results

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