• Home
  • Blog
  • this should be done in visual studio Add a method called add(). Here is complete code for the method:

this should be done in visual studio Add a method called add(). Here is complete code for the method:

0 comments

this should be done in visual studio

Add a method called add(). Here is complete code for the method:

public int add(int a, int b) {

  return a + b;

}

Add method called factorial() that accepts 1 int parameter called n. The body (implementation) of the method should be:

  int answer = 1;

  for (int i=2; i<=n; i++)

   answer *= i;

 return answer;

Add a method called multiply() that accepts two int parameters, a and b. Return an int product. 

Add a method called min() that accepts two int parameters. It should return the smaller of the two numbers as an int parameter.

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}