1 parent 1eb167d commit fa53b35Copy full SHA for fa53b35
1 file changed
Students/Gohonel/FirstAssignement - improved
@@ -0,0 +1,32 @@
1
+package Assignements;
2
+
3
+import java.util.Scanner;
4
5
+public class FirstAssignment {
6
+ public static void main(String[] args)
7
+ {
8
+ System.out.print("Enter up to where we go: ");
9
+ Scanner scan = new Scanner(System.in);
10
+ int i, j, sum = 0, a = 0, b = 0, c = 0, s = 0, n = 0;
11
12
+ i = scan.nextInt();
13
14
+ n = i / 3;
15
16
+ a = ( 3 * n * ( n + 1 ))/2;
17
18
+ n = i / 5;
19
20
+ b = ( 5 * n * ( n + 1 ))/2;
21
22
+ n = i / 15;
23
24
+ c = ( 15 * n * ( n + 1 ))/2;
25
26
+ s = a + b - c;
27
28
29
+ System.out.print("You number is: ");
30
+ System.out.println(s);
31
+ }
32
+}
0 commit comments