Home > Back-end >  Big help!
Big help!

Time:09-27

CodePudding user response:

Basic work, want to do,
You can do wrong, have questions to ask

CodePudding user response:

Public static void main (String [] args) {
//TODO Auto - generated method stub
Scanner sc=new Scanner(System.in);
System. The out. Println (" please enter the ceiling ");
The String between=sc. NextLine ();
System. The out. Println (" please enter the minimum: ");
Int the lower=sc. NextInt ();
For (int n=lower; N<=between; Upper and lower bounds n++) {//
int sum=0;//computing a few of the
For (int I=1; i<=n/2; I++) {
If I (n %==0) {//a few
The sum +=I;
}
}
If (sum==n) {
System. The out. Println (n)};
}
}

}
Bosses, I will write the leaves won't

CodePudding user response:

 
Public static void main (String [] args) {
Int between=1000;
Int the lower=100;
int sum=0;
For (int n=lower; N & lt;=between; Upper and lower bounds n++) {//
Sum=0;//computing a few of the
For (int I=1; i <=n/2; I++) {
If I (n %==0) {//a few
The sum +=I;
}
}
If (sum==n) {
String strSum=String. The valueOf (sum);
System. The out. Println (sum (strSum) + "\ t" + multiplication (strSum) + "\ t" + reversal (strSum) + "\ t" + Max (strSum) + "\ t" + min (strSum));

}
}
}


Public static int the sum (String num) {
The split String []=num. Split (" ");
int sum=0;
For (String STR: split) {
The sum +=Integer. The valueOf (STR);
}
Return the sum.
}

Public static int multiplication (String num) {
The split String []=num. Split (" ");
Int sum=1;
For (String STR: split) {
The sum *=Integer. The valueOf (STR);
}
Return the sum.
}

Public static int reversal (String num) {
StringBuffer newNum=new StringBuffer (num);
NewNum. Reverse ();
Return an Integer. The valueOf (newNum. Reverse (), toString ());
}

Public static int min (String num) {
The split String []=num. Split (" ");
Int min=Integer. The valueOf (split [0]).
For (String STR: split) {
Int next=Integer. The valueOf (STR);
Min=next & lt; Min? Next: min;
}
Return min;
}

Public static int Max (String num) {
The split String []=num. Split (" ");
Int Max=Integer. The valueOf (split [0]).
For (String STR: split) {
Int next=Integer. The valueOf (STR);
Max=next & gt; Max? Next: Max;
}
return max;
}
  • Related