Write a Java program to find the sum and average of three numbers.
Answers
Answered by
24
Answer:
class Sum
{
public static void main(String[]args)
{
int n1 =10;
int n2 =20;
int n3 =30;
int total sum =n1+n2+n3;
System.out.println("sum" +sum);
int sum =n1+n2+n3;
int average = n1+n2+n3/3;
System.out.println("Average");
}
}
Answered by
12
class SumAvg
{
public static void main(String args[]) {
int a, b, c
System.out.println("The three numbers are "
+ a + ", " + b + ", " + c );
int sum = a + b + c;
avg = sum / 3.0;
System.out.println("Sum = " + sum);
System.out.println("Average = " + avg);
}
}
Similar questions