Computer Applications
Write a program to find the sum and average of three numbers.
Java
Java Intro
165 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
Answered By
65 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 calculate the compound interest.
Write a program to interchange the value of two numbers without using the third variable.