Count number of Ones in Array

0 votes
asked Apr 10 by Saba Noor (120 points)
I need to count number of Ones of a 32 bit array in C.

1 Answer

+1 vote
answered Apr 11 by anu kanth sudharsanam (160 points)
#include <stdio.h>

int main()
    char a[32];
    int count=0,i;
    printf("Enter your string");
    printf("number of ones in an array is %d",count);

    return 0;
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.