package com.edu4java.javatutorials; import javax.swing.JOptionPane; public class WhileCounterAcumulator { public static void main(String[] args) { int counter = 0; int accumulator = 0; while (counter < 5) { counter = counter + 1; accumulator = accumulator + Integer.parseInt(JOptionPane .showInputDialog("Enter the " + counter + "ยบ number")); } JOptionPane.showMessageDialog(null, "The sum of the 5 numbers is " + accumulator); } }