Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // vnesi n broevi potoa najdi gi parnite i neparnite i isprintaj gi
- na vlez: 10
- 1 2 3 4 5 6 7 8 9 10
- izlez:
- parni: 30
- neparni: 25
- ------------------------------------------------------------------
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int n,i,broj;
- int sumPARNI = 0;
- int sumNEPARNI = 0;
- scanf("%d", &n);
- for(i=0;i<n;i++)
- {
- scanf("%d", &broj);
- if(broj %2 == 0)
- {
- sumPARNI += broj;
- }
- else
- {
- sumNEPARNI += broj;
- }
- }
- printf("%d\n%d", sumPARNI, sumNEPARNI);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement