Created
December 4, 2018 15:18
-
-
Save rkhang7/f2828fcf5ced421a8579a78e750393b2 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 1 chiều chỉ tồn tại 2 phần tử có giá trị là 10.
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]); | |
} | |
int s=0; | |
for(int i=0;i<n;i++) | |
{ | |
if(a[i]==10) s=s+1; | |
} | |
if(s==2) printf("Mang chi ton tai hai phan tu 10"); | |
else printf("Mang khong ton tai hai phan tu 10"); | |
getch(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment