Please support our Java advertiser: Lunarpages Java Web Hosting
•
•
Join Date: Oct 2007
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
hi, I seem to gotten my code run. But what I want is to display everything into a dialog box all at once. So when I type 3 it would display all the factorials starting from three...to 15 and display them according to number / Factorials.
5 to 15 all the factorials. It is only showing them in order now. Can someone give me some help?
Number Factorial
!1 ------ 1
!2 ------ 2
!3 ------ 6
!4 ------ 24
!15 ------ 2004310016
5 to 15 all the factorials. It is only showing them in order now. Can someone give me some help?
Number Factorial
!1 ------ 1
!2 ------ 2
!3 ------ 6
!4 ------ 24
!15 ------ 2004310016
import javax.swing.*; // program uses class JOptionPane
public class Factorial
{
public static void main( String args[] )
{
String integerInput;
int input;
int factorial;
integerInput = JOptionPane.showInputDialog("Enter a Factorial between 1-15:");
input = Integer.parseInt( integerInput);
// for ( input = 1; input <= 15; input++ )
{
factorial = 1;
for ( int numLess = 1; numLess <= input; numLess++ )
factorial *= numLess;
//display the message to user
JOptionPane.showMessageDialog(null, " Factorials of " + input + " is " Factorial;
} // end for loop
} // end main
} // end class Factorial
Last edited by atrix415 : Oct 20th, 2007 at 8:59 pm.
Similar Threads
Other Threads in the Java Forum
- Save dialog box (Visual Basic 4 / 5 / 6)
- displaying pictures on a dialog box (C++)
- How to display dialog box items? (C)
- "Server busy" Dialog box /help me (Viruses, Spyware and other Nasties)
- dialog box question (C)
- Dialog box wrong size (Windows NT / 2000 / XP / 2003)
- Common Open dialog box (C++)
- Dialog Box alongwith Form (Visual Basic 4 / 5 / 6)
- Display problems (Monitors, Displays and Video Cards)
Other Threads in the Java Forum
- Previous Thread: How get Image byte size & transfer Image over Socket?
- Next Thread: help me set path
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)






Threaded Mode