Count num of second digit occurences in first digit:

#include<stdio.h>
int main()
{
  int a,b,c=0,rem,t;
  scanf("%d %d",&t,&b);
   
    while(t>0)
    {
        rem=t%10;
        t/=10;
        if(rem==b)
            c++;
       
    }
    printf("%d",c);
    return 0;
}

Comments

Popular Posts