Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - C language, input a positive integer, count and output the number of 2 in the number.
C language, input a positive integer, count and output the number of 2 in the number.
# include & ltstdio.h & gt

Int countdigit (integer, integer);

int main()

{

Integer, number, result;

printf(" Enter in:number = ");

Scanf("%d %d ",& quantity & number);

Result = countdigit (number, digits);

The return value of printf("countdigit(%d, %d)) is: %d\n ",number, digit, result);

Returns 0;

}

Int countdigit (integer, integer)

{

int a,I;

a = 0;

I = 0;

And (number! =0)

{

A = number%10;

If (a==2)

i++;

number/= 10;

}

Return I;

}?