Given 4 numbers (passed in as parameters) write a function that returns the average of these numbers please write this with a function in java form example function.somthing() and make an html file of the version as well please somthing like this function Numbers() { for (let i = 1; i <= 10; i++) { console.log(i);} } WITH OUT PYTHON PLZ WITHOUT THIS CODE and if there is no other way then that then please return my qus import java.util.Scanner; public class AverageClass { public static void main(String[] args) { int a, b, c, d; Scanner sc = new Scanner(System.in); System.out.print("Enter 4 numbers : "); a = sc.nextInt(); b = sc.nextInt(); c = sc.nextInt(); d = sc.nextInt(); System.out.println("Average : " + average(a, b, c, d)); } static float average(int a, int b, int c, int d) { float sum; sum = a + b + c + d; return sum / 4; } }
Given 4 numbers (passed in as parameters) write a function that returns the average of these numbers
please write this with a function in java form example function.somthing()
and make an html file of the version as well please
somthing like this
function Numbers() {
for (let i = 1; i <= 10; i++) {
console.log(i);} }
WITH OUT PYTHON PLZ WITHOUT THIS CODE and if there is no other way then that then please return my qus
import java.util.Scanner;
public class AverageClass {
public static void main(String[] args) {
int a, b, c, d;
Scanner sc = new Scanner(System.in);
System.out.print("Enter 4 numbers : ");
a = sc.nextInt();
b = sc.nextInt();
c = sc.nextInt();
d = sc.nextInt();
System.out.println("Average : " + average(a, b, c, d));
}
static float average(int a, int b, int c, int d) {
float sum;
sum = a + b + c + d;
return sum / 4;
}
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps