-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray_9.java
More file actions
37 lines (29 loc) · 720 Bytes
/
array_9.java
File metadata and controls
37 lines (29 loc) · 720 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
public class array_9{
public static void main(String args[]){
int a[] ={121,31,144,523,572,354,876,742,192,432,4567,873};
int b[] = new int[a.length];
int temp=0;
for(int i=0; i<a.length; i++)
{
int count=0, sum=0;
int digit1 = a[i]/100;
int digit2 = (a[i]/10) % 10;
int digit3 = a[i]%10;
temp = a[i];
while(temp != 0){
sum*=10;
sum += temp%10;
temp/=10;
count++;
}
for(int j=1; j<count; j++)
digit2*=10;
b[i] = digit2 + digit3 * 10 + digit1;
}
for(int i=0; i<b.length; i++)
System.out.print(a[i]+" ");
System.out.println();
for(int i=0; i<b.length; i++)
System.out.print(b[i]+" ");
}
}