Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define MAX 100
- int main() {
- int i, n, a[MAX], brNep = 0, brPar = 0, sumNep = 0, sumPar = 0;
- scanf("%d", &n);
- for (i = 0; i < n; ++i)
- scanf("%d", &a[i]);
- for (i = 0; i < n; ++i) {
- if (a[i] % 2) {
- brNep++;
- sumNep += a[i];
- } else {
- brPar++;
- sumPar += a[i];
- }
- }
- printf("Suma parni: %d\nSuma neparni: %d\n", sumPar, sumNep);
- printf("Odnos: %.2f\n", (float)brPar / brNep);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement