Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- #include <iostream>
- using namespace std;
- int i, k, tong, a[100];
- void main()
- {
- printf("Nhap so phan tu cua mang: ");
- scanf("%d", &i);
- for (int j = 1; j <= i; j++)
- {
- printf("a[%d] = ", j);
- scanf("%d", &a[j]);
- }
- printf("Nhap gia tri can kiem tra k = ");
- scanf("%d", &k);
- for (int j = 1; j <= i; j++)
- {
- if (a[j] == k)
- {
- printf("k = %d thuoc phan tu trong mang", k);
- _getch();
- return;
- }
- }
- printf("k = %d khong thuoc phan tu trong mang", k);
- _getch();
- }
Add Comment
Please, Sign In to add comment