Skip to content
Open

done #77

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions src/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
public class Main {

public static void main(String[] args) {
int array[] = {1, 503, 4, 1900};
int max = array[0];
for (int i = 1; i < array.length; i++) {
if (array[i] > max) {
max = array[i];
}

}
System.out.println("Max number is " + max);
int min = array[0];
for (int i = 1; i < array.length; i++) {
if (array[i] < min) {
min = array[i];
}
}
System.out.println("Min number is " + min);
int difference = (max - min);
System.out.println("The difference is "+difference);
int smallest1 = Integer.MAX_VALUE;
int smallest2 = Integer.MAX_VALUE;
for (int i = 0; i < array.length; i++) {
if (array[i] < smallest1) {
smallest2 = smallest1;
smallest1 = array[i];
} else if (array[i] < smallest2 && array[i] != smallest1)
smallest2 = array[i];

}
System.out.println("The second smallest number is "+smallest2);


double x = 2;
double y = 3;
double d = (4 * y / 5 - x);
double result = x * x + d * d;
System.out.println("The result of 3rd task is: " + result);




}
}