Guest User

Untitled

a guest
Dec 13th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include<iostream>
  2. #include<string>
  3. #define max 100
  4. using namespace std;
  5.  
  6. void nhap(int a[],int &n)
  7. {
  8. do
  9. {
  10. cin>>n;
  11. if(n < 0 || n > max )
  12. {
  13. cout<<"xin nhap lai";
  14. }
  15. }while(n < 0 || n > max);
  16. for(int i = 0;i < n; i++)
  17. {
  18. cin>>a[i];
  19. }
  20. }
  21. void chan(int a[],int n)
  22. {
  23. for(int i = 1;i <= n;i++)
  24. {
  25. if(a[i]%2 == 0 )
  26. {
  27. cout<<a[i]<<"\t";
  28. }
  29. }
  30. }
  31.  
  32. int main()
  33. {
  34. int n;
  35. int a[max];
  36. nhap(a,n);
  37. chan(a,n);
  38. return 0;;
  39. }
Add Comment
Please, Sign In to add comment