Do bạn ko nón là code nào nên mình sẽ viết Java
import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
static int n = 50;
static float[] arr = new float[n];
static void nhapMang() {
System.out.print("Nhap so phan tu: ");
n = sc.nextInt();
arr = new float[n];
for (int i = 0; i < n; i++) {
System.out.print("Nhap phan tu thu " + (i + 1) + ": ");
arr[i] = sc.nextFloat();
}
}
static void xuatMang() {
System.out.println("Mang vua nhap:");
for (int i = 0; i < n; i++) {
System.out.print(arr[i] + " ");
}
System.out.println();
}
static int timPhanTuY(float y) {
int index = -1;
for (int i = n - 1; i >= 0; i--) {
if (arr[i] == y) {
index = i;
break;
}
}
return index;
}
static float tinhTrungBinhPhanTuChan() {
float sum = 0, count = 0;
for (int i = 0; i < n; i++) {
if (arr[i] % 2 == 0) {
sum += arr[i];
count++;
}
}
return count == 0 ? 0 : sum / count;
}
static float tinhTongPhanTuLe() {
float sum = 0;
for (int i = 0; i < n; i++) {
if (arr[i] % 2 != 0) {
sum += arr[i];
}
}
return sum;
}
static int demPhanTuLonHonHoacBang5() {
int count = 0;
for (int i = 0; i < n; i++) {
if (arr[i] >= 5) {
count++;
}
}
return count;
}
public static void main(String[] args) {
int choice;
do {
System.out.println("\n--- MENU ---");
System.out.println("1. Nhap mang");
System.out.println("2. Xuat mang");
System.out.println("3. Tim phan tu co gia tri y xuat hien cuoi cung");
System.out.println("4. Tinh trung binh phan tu chan");
System.out.println("5. Tinh tong phan tu le");
System.out.println("6. Dem so phan tu >= 5");
System.out.println("7. Ket thuc chuong trinh");
System.out.print("\nBan chon: ");
choice = sc.nextInt();
switch (choice) {
case 1:
nhapMang();
break;
case 2: