Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
numerodevecesquerepitedigitoennumero
#include <stdio.h> #include <stdlib.h> int main(void) { long long N; short d, b; int cifra,i; printf("Introduce un valor entero = "); scanf(" %lld", &N); printf("Introduce un valor (0-9) = "); scanf(" %hd", &d); i = 0; b = 0; while(N > 0) { cifra = N%10; if (cifra == d) { i = 1; b++; } N = N/10; } if(i == 1) printf("\nEl numero contiene la cifra (%hd) %hd veces.\n", d, b); else printf("\nEl numero no contiene la cifra (%hd).\n", d); return 0; }
run
|
edit
|
history
|
help
0
Ahora si?
fgets and basic string manipulation
swipe the numbers in cyclic way
base
a1
TruncatablePrime
Threads_posix
Mutex Safe
Switch
20171116_PI