Sumar 3 numeros - Java:
public class AddNumbers {
/**
* This method add three integers.
* @param numberOne first param to add.
* @param numberTwo second param to add.
* @param numberThree third param to add.
* @return int Obtains the sum of numberOne, numberTwo and numberThree.
*/
public int addIntegers(int numberOne, int numberTwo, int numberThree) {
//Variable to store the total sum
int total = 0;
//Sum the three numbers
total = numberOne+ numberTwo+ numberThree;
//Return the total
return total;
}
/**
* One Example
*/
public static void main(String args[]) throws IOException {
AddNumbers addNumbers= new AddNumbers ();
//Example
int sum = addNumbers.addIntegers(88, 22, 11);
//Output
System.out.println("Sum of 88, 22 and 11 is :" + sum); //110
}
}
Top comments (0)