Computer Applications
Write a program to find the sum and average of three numbers.
Java
Java Intro
176 Likes
Answer
public class KboatSumAvg
{
public static void computeSumAvg(int a, int b, int c) {
System.out.println("The three numbers are "
+ a + ", " + b + ", " + c );
int sum = a + b + c;
double avg = sum / 3.0;
System.out.println("Sum = " + sum);
System.out.println("Average = " + avg);
}
}
Output
![BlueJ output of Write a program to find the sum and average of three numbers. BlueJ output of Write a program to find the sum and average of three numbers.](https://cdn1.knowledgeboat.com/img/lgx8/c5-java-p4.jpg)
Answered By
70 Likes
Related Questions
Write a program to print your Name, Class, Roll_No, Marks and Age. Name this file, 'MyProfile'.
Write a program to print your School name four times in separate lines.
Write a program to interchange the value of two numbers without using the third variable.
Write a program to calculate the compound interest.