forked from Swatigupta-droid/Basic-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspecial number.java
More file actions
38 lines (34 loc) · 775 Bytes
/
special number.java
File metadata and controls
38 lines (34 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import java.io.*;
class special
{
public static void main( String args[])throws IOException
{
InputStreamReader in=new InputStreamReader(System.in);
BufferedReader y=new BufferedReader(in);
int n;
System.out.println("Enter a number");
{
n=Integer.parseInt(y.readLine());
}
int x=n,s,r=0,i;
while(n>0)
{
s=n%10;
int p=1;
for(i=1;i<=s;i++)
{
p=p*i;
}
r=r+p;
n=n/10;
}
if(x==r)
{
System.out.println( "it is a special number");
}
else
{
System.out.println("it is not a special number");
}
}
}