Created
December 3, 2018 03:02
-
-
Save rkhang7/90703cabbed8720aad39b9c6d577103c to your computer and use it in GitHub Desktop.
Sử dụng lại bài 29. Viết chương trình hiển thị những phần tử chẵn của mảng một chiều.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <conio.h> | |
int main() | |
{ | |
int n; | |
printf("Nhap so phan tu cua mang: ");scanf("%d", &n); | |
int a[n]; | |
for(int i=0;i<n;i++) | |
{ | |
printf("a[%d]=",i);scanf("%d", &a[i]); | |
} | |
printf("Cac phan tu chan cua mang bao gom: "); | |
for(int i=0;i<n;i++) | |
if( a[i]%2==0 ) | |
printf("%d\t", a[i]); | |
getch(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment