Untitled
unknown
plain_text
7 months ago
835 B
2
Indexable
Never
import java.util.Scanner; public class baitapso15 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a[] = {2, 1, 2, 1, 10, 291, 123, 1231231}; for (int x : a) { System.out.println(x); } // Bai tap System.out.println("Ban muon mang co bao nhieu phan tu ?\n"); int n = sc.nextInt(); int b[] = new int[n]; for (int i = 0; i < n; i++) { System.out.println("Nhap gia tri cho phan tu co index " + i); int input = sc.nextInt(); b[i] = input; } System.out.println("Cac so le vua duoc nhap o tren la:"); for (int y : b) { if (y % 2 != 0) { System.out.println(y); } } } }