Question: write methods that accepts two numbers and returns the average of the two numbers.
Solutions :
public class Ninetynine{
Ninetynine(){
hello("Afjal");
system.out.println(average(3,4));
}
public void hello(String s){
System.out.println("Hello "+s);
}
double average(double x, double y){
return (x+y)/2;
}
public static void main(String [] args){
new Ninetynine();
}
}
Output : 3.50
solve this program
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
useful to us
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit