1. public class naloga_2 {
  2. public static void main(String[] args) {
  3. String niz = new String();
  4. int vsota = 0, stevil = 0;
  5. while(vsota <= 100) {
  6. niz = javax.swing.JOptionPane.showInputDialog("Vpiši celo število!");
  7. try {
  8. vsota += Integer.valueOf(niz).intValue();
  9. stevil++;
  10. } catch(Exception e) {
  11. continue;
  12. }
  13. }
  14.  
  15. System.out.println("Vsota vseh stevil je: " + vsota);
  16. System.out.println("Prebranih je bilo " + stevil + " stevil.");
  17. System.exit(0);
  18. }
  19. }