-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstrobogramatic.java
54 lines (40 loc) · 1.08 KB
/
strobogramatic.java
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
public class strobogramatic {
public static void main(String[] args) {
int a;
a=1991;
int l=a;
int sum=0;
while(a>0)
{
sum=sum*10+a%10;
a=a/10;
}
int k=0;
while(sum>0)
{
int j=sum%10;
sum=sum/10;
if(j==1||j==8||j==0||j==9||j==6)
{
if(j==6)
{ j=9;
}
if(j==9)
{ j=6; }
System.out.println(j);
k=k*10+j;
System.out.println(k);
}
else
{
break;
}
}
if(l==k)
{
System.out.println("yes" +k);
}
else
System.out.println(""+k);
}
}