-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoops.java
More file actions
69 lines (47 loc) · 874 Bytes
/
Loops.java
File metadata and controls
69 lines (47 loc) · 874 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import java.util.*;
class Loops{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int p = sc.nextInt();
while (p-->0) {
int t = sc.nextInt();
int i=1,count=0;
while (i<=n) {
if(n%i==0)
count++;
i++;
}
int sum = 0;
if (t<0)
t=-t;
while (t>0) {
int d = t%10;
sum = sum*10 + d;
t = t / 10;
}System.out.println(sum *2);
}
// int i =1,ans=0;
// while(t-->0){
// int n = sc.nextInt();
// if(n<0)
// n=-n;
// while (n > 0) {
// ans = ans+ n % 10;
// n = n / 10;
// }
// }System.out.println(ans);
// int count = 0;
// int i = 1,j=1;
// while (i <= n) {
// while (j <= i) {
// if(i % j == 0)
// count++;
// j++;
// }
// i++;
// }if(count == 2)
// System.out.println("prime");
// else
// System.err.println("not prime");
}
}