Advertisement
anon20016

3

Dec 12th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <vector>
  3. #include <iostream>
  4. #include <string>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. int n = 17;
  11. int a[17];
  12. int sum_n = 0;
  13. for (int i = 0; i < n; i++) {
  14. cin >> a[i];
  15. if (a[i] % 2 != 0) {
  16. sum_n = sum_n + a[i];
  17. }
  18. }
  19. for (int i = 0; i < n; i++) {
  20. if (a[i] % 3 == 0) {
  21. a[i] = sum_n;
  22. }
  23. }
  24. for (int i = 0; i < n; i++) {
  25. cout << a[i] << ' ';
  26. }
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement