Write A program in Java to find and display the Sum and average of three numbers by using function argument
Answers
Answered by
7
Answer:
class Sample
{
public static void main(String args[])
{
int a=10, b=20, c=30;
sumavg(a,b,c);
}
public static void sumavg(int x, int y, int z)
{
int add = x+y+z;
System.out.println("Sum is = "+add);
System.out.println("Average is = " + add/3.0);
}
}
Answered by
14
Answer:
// To find the sum and avg of 3 numbers
class Sum_Avg
{
public static void main ( int a, int b, int c )
{
int sum = 0;
float avg = 0.0;
sum = ( a+b+c ) ;
avg = sum / 3.0 ;
System.out.println (" The sum = " + sum ) ;
System.out.println (" The Average = " +
avg ) ;
}
}
Pls thank my answers...
And mark me as BRAINLIEST....
Similar questions