I want to perm all the numbers from 1 to 100;
when i enter 1 as the beggining and 100 as the end it freezed my machine.
I manage to let the application accept only numbers that their range will let
the entry size limit to( the difference between the numbers<=20)
so the machine can proccess.Is there anyway to allow the application to perm
numbers from1to 100?
Some one should please run this application and try to rectify it to perm
numbers from 1 to 100 without freezing the machine...
Also the perm numbers will repeat numbers like (1,2) and(2,1)
**
* @(#)Perm.java
*
*
* @author
* @version 1.00 2009/1/30
*/
import javax.swing.JOptionPane;
public class Perm {
public Perm() {
}
public static void main(String[] args){
int Biggining=Integer.parseInt(JOptionPane.showInputDialog("Enter
beggining Value"));
int Ending=Integer.parseInt(JOptionPane.showInputDialog("Enter End
Value"));
boolean toobig =false;
int row=0;
int col=0;
String msg ="Sorry the range is too big cant do that";
System.out.println("From "+Biggining+" to "+Ending );
for ( row=Biggining; row <= Ending; row++) {
for ( col=Biggining; col <=Ending; col++) {
if((Ending-Biggining)<21){
System.out.print( "("+row+","+col+") "+" , " );}
else{
toobig=true;
break;}
}
}
if(toobig){
JOptionPane.showMessageDialog(null, msg);
}
//else{
}
}
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---