Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int nhapmang(int *a, int n) {
- for (int i = 0; i < n; i++) {
- cout << " nhap a[ " << i << "]";
- cin >> *(a + i);
- }
- return 0;
- }
- int suat(int *a,int n) {
- int k = 0;
- for(int i =0;i<n;i++){
- for (int j = 0; j < n; j++) {
- if ((*(a + i) % *(a + j) == 0)&&(j!=i)&&(k==0)) {
- k = 1;
- cout << *(a +i);
- }
- }
- }
- return 0;
- }
- void main() {
- int n;
- cout << "nhap n :";
- cin >> n;
- int a[5] = { 4, 6, 7, 8,12 };
- suat(a, 5);
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement