Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BIGGEST ELEMENT
- import java.util.ArrayList;
- import java.util.Scanner;
- public class main {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int [] array = {5,6,78,37,31,45};
- int max = array[0];
- for(int i = 1; i<array.length; i++){
- if(array[i]>max) {
- max = array[i];
- }
- }
- System.out.println(max);
- }
- }
- EQUALS ARRAYS
- import java.util.ArrayList;
- import java.util.Scanner;
- public class main {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- boolean equals = false;
- while (true) {
- String[] a = scan.nextLine().split(" ");
- String[] b = scan.nextLine().split(" ");
- if (a.length != b.length) {
- System.out.println("not equals");
- break;
- }
- if (a.length == b.length) {
- for (int i = 0; i < a.length; i++) {
- int a1 = Integer.parseInt(a[i]);
- int b1 = Integer.parseInt(b[i]);
- if (a1 == b1) {
- equals = true;
- continue;
- } else if (a1 != b1) {
- equals = false;
- }
- }
- if (equals == true) {
- System.out.println("equals");
- } else if (equals != true) {
- System.out.println("not equals");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement