-2
Action
Receive two integers from the user, the first being the digit you want to know how many times it appears and the second being the contact number.
In and out
Entree:
Integer value A (between 1 and 9).
Integer value B.Exit:
Number of times digit A appears in B
#include <stdio.h>
int main(void)
{
int contaDigitos = 0, valor;
scanf("%d", &valor);
if (valor == 0) contaDigitos = 1;
else
while (valor != 0)
{
contaDigitos = contaDigitos + 1;
valor = valor / 10;
}
printf("%d\n", contaDigitos);
return 0;
}
Therefore, although you have a well trained eye here, try to explain better what problem you are having, so that the staff can help you without having to figure out/guess, editing your question (probably help will come faster like this) - take advantage and do the tour and read here how to ask
– Daniel
something like: "I am making a program that does X - when compiling, the error is Y - or, when executing, instead of the expected result, it shows Z" - ah, and welcome to the stackoverflow! =)
– Daniel