Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void main() {
- int broj, br1 = 0;
- int n, i, a[200], cifra, m, j;
- printf("Unesite koliko brojeve zelite da unesete=");
- scanf("%d", &n);
- for (i = 0;i < n;i++) {
- scanf("%d", &broj);
- while (broj > 0) {
- if (broj % 2 == 0) {
- cifra = 0;
- broj = broj / 2;
- }
- else {
- cifra = 1;
- broj = broj / 2;
- br1++;
- }
- }
- }
- printf("broj jedinica = %d", br1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement