1 parent 74ae5db commit 1eb167dCopy full SHA for 1eb167d
2 files changed
Students/Gohonel/SecondAssignment.txt
@@ -0,0 +1,21 @@
1
+package Assignements;
2
+
3
+public class SecondAssignment {
4
+ public static void main(String[] args)
5
+ {
6
+ int i = 1 , j = 2, sum = 0;
7
8
+ while ( j < 4000000 )
9
10
+ if ( (j % 2 == 0) && (j < 4000001) )
11
12
+ sum = sum + j;
13
+ }
14
15
+ j = j + i;
16
+ i = j - i;
17
18
+ System.out.print("Your result is: ");
19
+ System.out.println(sum);
20
21
+}
Students/Gohonel/ThirdAssignment.txt
@@ -0,0 +1,58 @@
+public class ThirdAssignment {
+ public static int test (int t)
+ int i, k;
+ int array[] = new int[6];
+ for ( i = 0; i < 6; i++)
+ array[i] = t % 10;
+ t = t/10;
+ if ( array[5] == 0)
+ k = 5;
+ }else{
+ k = 6;
22
23
+ for ( i = 0; i < k; i++)
24
25
+ if ( array[i] != array [(k-1) - i] )
26
27
+ return 0;
28
29
30
31
+ return 1;
32
33
34
35
36
+ int i, j = 0, max = 0, maxi = 0, maxj = 0, prod;
37
38
39
+ for ( i = 100; i < 1000; i++)
40
41
+ for ( j = 100; j < 1000; j++)
42
43
+ prod = i * j;
44
+ if ( test(prod) == 1 && prod > max)
45
46
+ max = prod;
47
+ maxi = i;
48
+ maxj = j;
49
50
51
52
53
+ System.out.print("Largest Palindrome is: "+max);
54
+ System.out.print(", made by the numbers " + maxi + " and " + maxj);
55
56
57
58
0 commit comments