-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLesson_3.java
More file actions
69 lines (56 loc) · 1.53 KB
/
Lesson_3.java
File metadata and controls
69 lines (56 loc) · 1.53 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
62
63
64
65
66
67
68
69
import java.util.Scanner;
public class Lesson_3 {
public static void main(String[] args) {
fun_6(100, 10, 200);
}
private static void fun_6(int x, int p, int y) {
int res = 0;
while (x < y) {
x = x + x * p / 100;
res++;
System.out.println("Годов прошло - " + res + " Денег в банке - " + x + "руб");
}
System.out.println(res);
}
private static void fun_5(double x, int y) {
int res = 1;
while (x < y) {
x *= 1.1;
res++;
// System.out.println("Номер дня - " + res + " Пробежал - " + x + "км");
}
System.out.println(res);
}
private static void fun_4(int N) {
int a = 1;
while (a <= N) {
System.out.println(a);
a *= 2;
}
}
private static void fun_3(int N) {
for (int i = 2; i <= N; i++) {
if (N % i == 0) {
System.out.println(i);
break;
}
}
}
private static void fun_2(int N) {
while (N % 2 == 0) {
N = N / 2;
}
if (N == 1) {
System.out.println("YES");
} else {
System.out.println("No");
}
}
private static void fun_1(int N) {
// Scanner s = new Scanner(System.in);
// int N = s.nextInt();
for (int i = 1; i <= Math.sqrt(N); i++) {
System.out.println((int) Math.pow(i, 2));
}
}
}