Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import acm.program.ConsoleProgram;
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- /**
- *
- * @author prb7
- */
- public class Problema2 extends ConsoleProgram{
- public int max(int[] numbers){
- int max=0;
- for(int i=0; i<numbers.length;++i){
- if(numbers[i]>max){
- max=numbers[i];
- }
- }
- return (max);
- }
- public void run(){
- int[] nums = new int[] {4,12,-5,3};
- int max = max(nums);
- println("el resultat es " + max);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement