File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ import java .math .BigInteger ;
2
+ public class specialBigInteger {
3
+ public static void main (String [] args ) {
4
+ // TODO Auto-generated method stub
5
+ BigInteger A = new BigInteger ("1" ); // your number to be checked
6
+ System .out .println ("value choosen :" +A );
7
+ BigInteger temp = A ;
8
+
9
+ BigInteger digit =new BigInteger ("0" );
10
+ int co =0 ,ten =10 ;
11
+ BigInteger sum = new BigInteger ("0" );
12
+ for (;(A .compareTo (BigInteger .valueOf (co )) != 0 );A =A .divide (BigInteger .valueOf (ten ))) {
13
+ digit =A .remainder (BigInteger .valueOf (ten ));
14
+ int k =1 ;
15
+ BigInteger fac =new BigInteger ("1" );
16
+ for (; (digit .compareTo (BigInteger .valueOf (k ))>= 0 );k ++) {
17
+ fac = fac .multiply (BigInteger .valueOf (k ));
18
+ }
19
+ sum =fac .add (sum );
20
+ }
21
+ if (sum .compareTo (temp ) == 0 )
22
+ System .out .println ("Special Number " );
23
+ else
24
+ System .out .println ("Not a Special Number " );
25
+ }
26
+
27
+ }
You can’t perform that action at this time.
0 commit comments