- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpecialNumber.java
More file actions
Latest commit
35 lines (29 loc) · 707 Bytes
/
Copy pathSpecialNumber.java
File metadata and controls
35 lines (29 loc) · 707 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
importjava.util.Scanner;
classSpecialNumber
{
publicstaticvoidmain(String[] args)
{
Scanners= newScanner(System.in);
System.out.println("---- Program will Print SPECIAL NUMBER of given range");
System.out.println("Enter Start number :" );
intstart = s.nextInt();
System.out.println("Enter End number :" );
intend = s.nextInt();
for (inttemp=start;start<=end ;start++ )
{
intsum = 0;
intprod = 1;
intcount = 0;
for (inti=start;i>0 ;i=i/10 )
{
intdigit = i%10;
sum = sum+digit;
prod = prod*digit;
}
if (start == (sum+prod))
{
System.out.println("Special Number is : "+start );
}
}
}
}