Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package ciąg;
- import javax.swing.JOptionPane;
- /**
- *
- * @author s8582
- */
- public class Main {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- int ilosc = Integer.parseInt(JOptionPane.showInputDialog("Podaj ilość elementów"));
- int najwieksza = 0;
- for(int i=0; i<ilosc; i++) {
- int liczba = Integer.parseInt(JOptionPane.showInputDialog("Podaj liczbę nr"+(i+1)));
- if(i==0) {
- najwieksza = liczba;
- } else if(liczba>najwieksza) {
- najwieksza = liczba;
- }
- }
- JOptionPane.showMessageDialog(null, "Największa liczba to: "+najwieksza);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement