tuki2501

dem_so_so_la_boi_cua_k.cpp

Jan 27th, 2021
678
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5.   int n, k, a[100];
  6.   cout << "Nhap n: ";
  7.   cin >> n;
  8.   cout << "Nhap k: ";
  9.   cin >> k;
  10.   for (int i = 0; i < n; i++) {
  11.     cout << "Nhap a[" << i << "] = ";
  12.     cin >> a[i];
  13.   }
  14.   int cnt = 0;
  15.   for (int i = 0; i < n; i++) {
  16.     if (a[i] % k == 0) cnt++;
  17.   }
  18.   cout << "So so la boi cua k: " << cnt;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment