-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA71.java.bak
More file actions
61 lines (49 loc) · 1.12 KB
/
A71.java.bak
File metadata and controls
61 lines (49 loc) · 1.12 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
import java.util.Scanner;
public class A72{
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 totalcount = 0;
while(lower<=upper)
{
int count = 0;
temp = lower;
int sum = 0;
while(temp>0)
{
count++;
temp = temp/10;
}
temp = lower;
while(temp>0)
{
int digit = temp%10;
//System.out.println("unit "+digit);
int prod = 1;
//System.out.print("count "+count);
int pow = count;
while(pow>0)
{
prod = prod*digit;
pow--;
}
sum = sum+prod;
//System.out.println("product "+prod);
//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)
{
totalcount = totalcount+1;
}
lower++;
}
System.out.println("count of Arm strong no is "+ totalcount);
}
}