2-laboratoriya ishi
16-variant
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("n = ");
int n = in.nextInt();
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = in.nextInt();
}
int k = Integer.MIN_VALUE;
for (int i = 1; i < n-1; i++) {
k = (Math.abs(arr[i-1]-arr[i+1]) < 72 && arr[i] > k) ? arr[i] : k;
}
if (k == Integer.MIN_VALUE)
System.out.println("Qo'shni elementlari ayirmasi 72 dan kichik element topilmadi");
else
System.out.println(k+" elementning qo'shni elementlari ayirmasi 72 dan kichik");
}
}
Do'stlaringiz bilan baham: |