Advertisement
jordanov

Untitled

Nov 21st, 2018
425
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. // vnesi n broevi potoa najdi gi parnite i neparnite i isprintaj gi
  2. na vlez: 10
  3.  
  4. 1 2 3 4 5 6 7 8 9 10
  5.  
  6.  
  7. izlez:
  8. parni: 30
  9.  
  10. neparni: 25
  11. ------------------------------------------------------------------
  12.  
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15.  
  16. int main()
  17. {
  18. int n,i,broj;
  19. int sumPARNI = 0;
  20. int sumNEPARNI = 0;
  21. scanf("%d", &n);
  22.  
  23. for(i=0;i<n;i++)
  24. {
  25. scanf("%d", &broj);
  26. if(broj %2 == 0)
  27. {
  28. sumPARNI += broj;
  29. }
  30. else
  31. {
  32. sumNEPARNI += broj;
  33. }
  34. }
  35. printf("%d\n%d", sumPARNI, sumNEPARNI);
  36.  
  37.  
  38.  
  39.  
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement