import javax.swing.*; public class ProblemA { public static void main(String[] args) { int N = Integer.parseInt(JOptionPane.showInputDialog("Enter positive integer N")); if (N % 9 == 0) { JOptionPane.showMessageDialog(null, "Ultimate collapse is 9"); } else { JOptionPane.showMessageDialog(null, "Ultimate collapse is " + N % 9); } } }