Computer Science, asked by pushpasinghrkl, 2 months ago

1
Write a program to find average of three numbers 7, 8 and 4.​

Answers

Answered by jasonfrancis1811420
2

Answer :

import java.util.Scanner;

public class JavaExample {

public static void main(String[] args)

{

Scanner scan = new Scanner(System.in);

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

double num1 = scan.nextDouble();

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

double num2 = scan.nextDouble();

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

double num3 = scan.nextDouble();

scan.close();

System.out.print("The average of entered numbers is:" + avr(num1, num2, num3) );

}

public static double avr(double a, double b, double c)

{

return (a + b + c) / 3;

}

}

Answered by CJSINGHCHOUPRAGEORGE
1
Which language you need answer of comment me
Similar questions