Write a java program which accept three numbers 12, 14 and 23 in variables a, b and c respectively. Find and print their average.
Answers
Answered by
1
Answer:
import java.util.*;
public class Question {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter 3 Numbers");
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
double d = (a+b+c)/3;
System.out.println("Average = "+d);
}
}
Answered by
2
Question:-
- Write a java program which accept three numbers in variables a, b and c respectively. Find and print their average.
Program:-
class X
{
public static void main(int a, int b, int c)
{
double av=(a+b+c)/3.0;
System.out.println("Average is: "+av);
}
}
Similar questions