Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- /*
- * 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 Hantack
- */
- public class Practica02 {
- public static void main(String[] args) {
- Scanner obj = new Scanner(System.in);
- int array[] = new int[5];
- for (int i = 0; i < 5; i++) {
- System.out.println("Ingresa número "+i);
- array[i] = obj.nextInt();
- }
- int mayor = array[0];
- for (int i = 1; i < 5; i++) {
- if(array[i]>mayor){
- mayor = array[i];
- }
- }
- System.out.println("El número mayor es el "+mayor);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement