Let ns be the number of 0s in the binary string s Find a rec
Let n(s) be the number of 0s in the binary string s. Find a recursive definition for n
Solution
#include<stdio.h>
 #include<stdlib.h>
 #include<string.h>
 #include<conio.h>
int zeros = 0;
int NumberOfZeros(char *string)
{
 if(string[0] == \'\\0\')
 {
 return zeros;
 }
else
{
if((string[0]) == \'0\')
{
            zeros++;
           
 }
        NumberOfZeros(string+1);
}
}
int main()
{
   
 char string[100]={0};
printf(\"Enter the binary number:\ \");
scanf(\"%s\",string);
printf(\"The number of 0\'s : %d\",NumberOfZeros(string));
   getch();
 return 0;
}

