tuki2501

thay_the_am_bang_khong.cpp

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