Created
December 4, 2018 08:32
-
-
Save rkhang7/63eae6026dbd1f50a5b97505f53045db to your computer and use it in GitHub Desktop.
Sử dụng lại bài 29. Viết chương trình cho biết mảng chỉ tồn tại số lẻ.
This file contains hidden or 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]); | |
} | |
for(int i=0;i<n;i++) | |
{ | |
if(a[i]%2==0) | |
{ | |
printf("Mang co ton tai so chan"); | |
break; | |
} | |
else | |
{ | |
if(i==n-1) | |
printf("Mang chi ton tai so le "); | |
} | |
} | |
getch(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment