Я хочу показать факторный результат и работу (расчет) в том же диалоговом окне JOptionPane
, как пример 1x2x3x4x5=120
и потратил часы, но не нашел решения. Любая помощь будет высоко оценена. :)
private fun uploadWithTransferUtility(remote: String, local: File) {
String number = JOptionPane.showInputDialog("Please enter the number below ");
int n = Integer.parseInt(number);
long fact = 1;
int i = 1;
if (n<=0){
JOptionPane.showMessageDialog(null," Please enter a possitive number");
}
else{
while(i<=n)
{
if (i==1){
fact = fact * i;
System.out.print(i);
i++;
}
else{
fact = fact * i;
System.out.print("*"+i);
i++;
}
JOptionPane.showMessageDialog(null,"="+fact);
}