Tuesday, March 5, 2024

34. Count total numbers of 0 in a number :—

34. Count total numbers of 0 in a number :—


#include<stdio.h>

int main()

{

    int count,n,r;

    count=0;

    printf("enter a value of n ");

    scanf("%d",&n);

    while(n>0)

    {

        r=n%10;

        if(r==0)

        {

            count++;

        }

        n=n/10;

    }

    printf("%d",count);

    return 0;

}


No comments:

Post a Comment