-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA613.java
More file actions
49 lines (40 loc) · 955 Bytes
/
A613.java
File metadata and controls
49 lines (40 loc) · 955 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
39
40
41
42
43
44
45
46
47
48
49
import java.util.Scanner;
public class A613{
public static void main(String[] args) {
Scanner s1 = new Scanner(System.in);
System.out.print("Enter a start and end limit ");
int lower = s1.nextInt();
int upper = s1.nextInt();
int temp = 0;
int count = 0;
while(lower<=upper)
{
temp = lower;
int sum = 0;
while(temp>0)
{
int digit = temp%10;
//System.out.println("unit "+digit);
int fact = 1;
while(digit>0)
{
fact = fact*digit;
digit--;
}
sum = sum+fact;
//System.out.println("factorial "+fact);
//System.out.println("sum "+sum);
temp = temp/10;
//System.out.println("tempno/10 "+temp);
}
//System.out.print("sum "+sum);
//System.out.println("lower "+lower);
if(sum == lower)
{
count = count+1;
}
lower++;
}
System.out.println("count of strong no is "+ count);
}
}